Search code examples
ios5automatic-ref-countingxcode4.2

ios5 ARC what is the compiler flag to exclude a file from ARC?


Can anyone help me remember what was the flag to tell the XCode to not use ARC for some file? I had several files in my project marked as such... Until I added another file and decided to convert that one to ARC. Sounds easy, right? I expected that I would be able to simply check a file that I want and let the XCode do it's magic. Well, not so easy, during pre-check it stripped all -Noarc flags from the files and now I need to manually re- apply the flag to several files.

the moral of this story is: once your project is in ARC and you have some files marked as no ARC, do not re-run the convert to ARC tool from Refactor>Convert to ARC. It will not restore your settings even if pre-check fails.


Solution

  • I found the answer: to exclude the file from ARC, use the -fno-objc-arc flag in build phases>compile sources