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

Compiler ConstructionIos5xcode4.2Automatic Ref-Counting

Compiler Construction Problem Overview


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.

Compiler Construction Solutions


Solution 1 - Compiler Construction

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

Solution 2 - Compiler Construction

> 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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex StoneView Question on Stackoverflow
Solution 1 - Compiler ConstructionAlex StoneView Answer on Stackoverflow
Solution 2 - Compiler ConstructionalokardView Answer on Stackoverflow