I am using ARC successfully in my project. However, I have encountered a few files (e.g., in unit tests and mock objects) where the rules of ARC are a little more fragile right now. I recall hearing that there was a way to disable ARC on a per-file basis, though I have been unable to find this option.
Is this possible? How do I disable ARC on a per-file basis?
It is very simple way to make individual file non-arc.
Follow below steps :
Disable ARC on individual file:
Select desired files at Target/Build Phases/Compile Sources in Xcode
Select .m file which you want make it NON-ARC PRESS ENTER Type -fno-objc-arc
Non ARC file to ARC project flag :
-fno-objc-arc
ARC file to non ARC project flag :
-fobjc-arc
Disable ARC on MULTIPLE files:
;)
Note: if you want to disable ARC for many files, you have to:
-fno-objc-arc
The four Mandatory Step as explained in this video
It is possible to disable ARC for individual files by adding the
-fno-objc-arc
compiler flag for those files.You add compiler flags in Targets -> Build Phases -> Compile Sources. You have to double click on the right column of the row under Compiler Flags. You can also add it to multiple files by holding the cmd button to select the files and then pressing enter to bring up the flag edit box. (Note that editing multiple files will overwrite any flags that it may already have.)
I created a sample project that has an example: https://github.com/jaminguy/NoArc
See this answer for more info: Disable Automatic Reference Counting for Some Files
I think all the other answers are explaining how to disable MRC(Manual Reference Count) and enabling ARC(Automatic Reference Count). To Use MRC(Manual Reference Count) i.e. Disabling ARC(Automatic Reference Count) on MULTIPLE files: