Xcode - Disable ARC for individual files

Jul 25, 2012 · Follow on Twitter and Mastodon ios

I am building an app that uses ARC (Automatic Reference Counting), which means I from now on will not have to handle memory management as actively as I have done before. There are still things you have to consider when using ARC, but it makes memory management a lot easier and less tedious.

I have also rewritten all non-ARC code, since the compiler will not compile code that uses release, dealloc (incorrectly) etc. However, I have now found out that instead of rewriting all of your code, you can disable ARC for a single file. Just add the file path to a flag to the file under “Build phases”, and the compiler will ignore ARC for the specific file.

It’s all wonderfully described on this page.

Discussions & More

Please share any ideas, feedback or comments you may have in the Disqus section below, or by replying on Twitter or Mastodon..

If you found this text interesting, make sure to follow me on Twitter and Mastodon for more content like this, and to be notified when new content is published.

If you like & want to support my work, please consider sponsoring me on GitHub Sponsors.