55

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.

Cristik
  • 30,989
  • 25
  • 91
  • 127
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
  • 1
    @NJones: well, it's that one that pops up on Google for the "exclude file arc" keywords :) – KPM Jan 30 '12 at 17:03
  • 8
    @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 Feb 06 '12 at 16:24

2 Answers2

175

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

Alex Stone
  • 46,408
  • 55
  • 231
  • 407
  • 42
    Hey, I wanna add, that if you want to add a compiler flag to multiple files in xcode, shift-select multiple files and press enter, and then paste, enter again. Double-clicking doesn't work for multiple selection. – Can Feb 29 '12 at 22:56
2

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

alokard
  • 79
  • 3