Convert App to ARC while ignoring files?

℡╲_俬逩灬. 提交于 2019-12-05 22:35:33

问题


I want to convert my app to ARC but I have some external librarys and frameworks that are not complaint with ARC. I know when yous start a new project using ARC, you can later specify which files to ignore. But can you do this when upgrading an existing app to ARC?


回答1:


in XCode, go to your active target and select the Build Phases tab. In the Compiler Flags column, set -fno-objc-arc for each of the files you don't want ARC

EDIT:

Also, to have the opposite behavior, I mean to use a file that was written using ARC inside a non ARC project, you can set the file flag to -fobjc-arc instead

There is plenty of more info regarding ARC here: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#general




回答2:


ARC may be explicitly enabled with the compiler flag -fobjc-arc. It may also be explicitly disabled with the compiler flag -fno-objc-arc. The last of these two flags appearing on the compile line "wins".

Source: http://clang.llvm.org/docs/AutomaticReferenceCounting.html




回答3:


To add to Felipe's answer, if you want to add this to multiple files at once:

Select all the files you want to exclude form ARC

Press 'Enter'

The pop-up box will appear at the last file in the list

Type -fno-objc-arc



来源:https://stackoverflow.com/questions/8335873/convert-app-to-arc-while-ignoring-files

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