How To Disable ARC For Objective-C Files

In iOS development you are using ARC almost all of the time. However, sometimes you have to disable ARC for Objective-C files.

ARC – Automatic Reference Counting

In the early days of iOS development, memory management played a major role. Because a traditional garbage collection was too inefficient for a mobile device, iOS transferred the responsibility for memory management to the developers. You needed to increase and decrease the so-called reference counter of an object manually.

This way you were able to write very memory efficient applications because objects were immediately deallocated when they were not used any more. But on the other hand managing the memory on your own was also very difficult. It was very common to produce hard to find bugs. So it was clear that this was not the best solution for the memory problem.

The solution was introduced with iOS 5: Automatic Reference Counting (ARC). From now on the reference counting commands were injected at compile time. On the one hand this still leads to very memory efficient code and on the other hand the developer doesn’t need to take care of it any longer. The solution was so good that in the meantime all Mac OS X applications are using ARC as well.

Disable ARC for Objective-C files

However, if you are using old Objective-C files, it can happen that this code doesn’t use ARC. Instead, it handles the memory on its own. Then the code will not compile because you are not allowed to increase and decrease the reference counter, if ARC is enabled.


So if you are in this scenario, you can disable ARC for that specific Objective-C file. For that go to “Build Phases”, open “Compile Sources” and add the compiler flag “-fno-objc-arc” to your Objective-C file:


Now there are no compiler errors anymore.


Image @ Godlikeart /

Book Tip

Big Nerd Range Guide: iOS Programming: Excellent introduction to iOS development. Some programming experience is recommended.