Disabling the ARC in Xcode 4.2

With Xcode 4.2 (iOS 5) Apple introduce ARC (Automatic Reference Counting) to help with memory management. Basically you no longer need to call retain or release. However current examples/books (and (open source) libraries) are still doing it. This leads to (annoying) errors like:

ARC forbids explicit message send of ‘retain’

To get rid of this error you need to disable ARC, but how? I found this link which show how to disable it for cetain source files, but I wanted this to be a global setting.

My Kaazing colleague Richard Clark told me how to turn off ARC at the project level. Here is what you need to do in Xcode:

  1. Select your project file.
  2. You should be in the “Build settings” tab. Select the “levels” option (default is “Combined”)
  3. There’s a search field to the right of “Combined”. Enter “Automatic”
  4. Second group should be “Apple LLVM Compiler 3.0 – Language”. Second line under that controls ARC.
  5. Click that line, then in the middle column (where it says “yes”), click and choose “no”.
Now the error is gone. Great!
Thanks Richard🙂

Howdy!

Posted in Uncategorized
19 comments on “Disabling the ARC in Xcode 4.2
  1. susuquay says:

    Matthias, i have same problem. Try to do the same but same error still. I am still trying you have any advice for me, i appreciate!

  2. David says:

    Thanks Matthias all the way from Sydney Australia!

  3. Thanks also from Pyrmont, Sydney Australia also😀

  4. Symon says:

    Great!

  5. ran into the reverse problem, had set it to off at the project start and needed it on for the objective-c big nerd ranch book. This also helped me figure out how to enable, so thanks for posting this, much appreciated.

  6. Keith says:

    Thank you! I’m reading Cocoa and Objective C “Up and Running” It’s funny how quick printed material becomes outdated.

  7. olaf says:

    Very USEFULL!!!!!. . .TNX

  8. Caner says:

    Thanks. Although ARC is a great feature, old tutorials or classes (like CocoaAsyncSocket) do not work with it.

  9. lehtu says:

    Thanks from finland too!

  10. Thanks from Marlborough Connecticut, USA!

    This was a big headache this morning. Got it solved with your help. Thanks!

  11. Jason K. says:

    Excellent! Worked like a charm! Thank you!

  12. Donovan Tierra says:

    Thanks from the lowest-paid in IT, Philippines!😦

  13. […] https://matthiaswessendorf.wordpress.com/2011/09/12/disabling-the-arc-in-xcode-4-2/ Share this: Read more from GUI Programs, iOS Tag: Automatic Reference Counting, Enter Automatic Click here to cancel reply. […]

  14. […] "jqmodal", embeddedHeight: "400", embeddedWidth: "425", themeCSS: "" }); . Disabling the ARC in Xcode 4.2 « Matthias Wessendorf’s Weblog . Cambios de Xcode 3 a […]

  15. me says:

    You are the man!

  16. atmorphius says:

    Thanks from Mexico too 😀

  17. Lior Kesos says:

    Thanks from Israel!

  18. tamarashv says:

    TNX from Israel !!! usefull :)))

  19. Thanks from the United Kingdom.
    You’re brilliant. I hope you know that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: