55
votes

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.

2
@NJones: well, it's that one that pops up on Google for the "exclude file arc" keywords :)KPM
@NJones If it's been asked "so many times"... your post would fall on far-less-aggravated-ears, had you bothered to provide a simple link to this vaporous treasure-trove of info you refer to... vs. taking the time to post what amounts essentially a diss, dare I say a poopoo.Alex Gray

2 Answers

175
votes

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

2
votes

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.

You can restore your settings for excluded files by removing references on them and then readd to project back