Xcode ARC (automatic reference counting), “release is unavailable”

久未见 提交于 2019-11-27 20:53:08
NJones

You have two options:

1) Turn off ARC for this project. This is done by setting 'Objective-C Automatic Reference Counting' to NO in the 'Build Settings' tab of your target in the project page.

2) Remove all retain release autorelease NSAutoReleasePools and retainCount calls, since ARC makes them for you. With the exception of NSAutoReleasePools They have been replaced by @autorelease{}.

The second option has been automated by apple see this question to use the refactoring tool.

Aleksander Azizi

The two options given by NJones are valid and effective ways of dealing with ARC incompatibility. However, you do have a third option. Disabling ARC for specific files.

Giving the flags -fno-objc-arc to your non ARC compatible compile sources affectively marks them as such upon compilation.

You can find your compile sources under TargetsYour AppBuild PhasesCompile Sources.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!