How can one turn ARC off for specific file

余生长醉 提交于 2019-12-04 00:47:11

I've had this happen more than once for me in 4.2 in different projects, but then I've not been able to reproduce it reliably enough for a bug report. But I can say in my cases, a clean build cleared it up.

Click the Edit menu, go to Refactor > Convert to Objective-C ARC... Click the disclosure triangle next to your project name and check all files for which you want to use ARC.

It is possible to disable ARC for individual files by adding the -fno-objc-arc compiler flag for those files.

You add compiler flags in Targets -> Build Phases -> Compile Sources. You have to double click on the right column of the row under Compiler Flags. You can also add it to multiple files by holding the cmd button to select the files and then pressing enter to bring up the flag edit box.

I created a sample project that has an example: https://github.com/jaminguy/NoArc

See this answer for more info: Disable Automatic Reference Counting for Some Files

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