禁用在Xcode中的特定文件的ARC

来源:互联网 发布:android 打开淘宝店铺 编辑:程序博客网 时间:2024/06/06 02:06
ARC (Automatic Reference Count) was introduced with XCode 4.2. This means that you no longer have to release, autorelease, or retain in your code. This makes it easier when writing code but a little difficult when importing or copying code snippets from existing code written for older versions. You might get errors such as 
'release' is unavailable: not available in automatic reference counting mode
or
ARC forbids explicit message send of 'release'
or
ARC forbids explicit message send of 'autorelease'


To avoid these errors, you can disable arc for your imported files. Here is how:

1. Click on your project in the Project Navigator, and then on the Target.
Picture
2. Under "Build Phases", expand "Compile Sources".

3. Click on the file you want to edit and type in -fno-objc-arc. It should appear in the "Compiler Flags" column.
Picture



原创粉丝点击