Disable Automatic Reference Counting for Some Files

nonamelive picture nonamelive · Jun 23, 2011 · Viewed 53.6k times · Source

I have downloaded the iOS 5 SDK and found that ARC is a great feature of the new Apple compiler. For the time being, many third party frameworks don't support ARC. Could I use ARC for my new code and keep the current retain/release code unchanged? The ARC converter doesn't work here, because some frameworks, such as JSONKit, cannot be converted to ARC by using the converter.

Edit:

The answer is to add -fno-objc-arc to the compiler flags for the files you don't want ARC. In Xcode 4, you can do this under your target -> Build Phases -> Compile Sources.

Answer

Tibidabo picture Tibidabo · Apr 25, 2012

It is not very intuitive how to disable ARC on MULTIPLE files, for a while I was do it one by one until a figured out how to do that.

  1. Select desired files at Target/Build Phases/Compile Sources in Xcode (CMD+click or Shift+click)
  2. PRESS ENTER (double click will reset the selection, so it does't work)
  3. Type -fno-objc-arc
  4. Press Enter or Done