How to enable Automatic Reference Counting (ARC) in XCode 4.2

Hi,

First of all, Automatic Reference Counting or ARC in the new Apple LLVM 3.0 compiler is a very interesting feature and I found it very useful, cause, I don’t have to worry about my pointers anymore. But the problem I faced is that, I have a lot of projects built on earlier version of XCode and definitely didn’t have the ARC enabled. So I have to manually enable the ARC for those projects. To enable ARC for your old projects, do the following –

  • Open the project in XCode 4.2
  • Make sure you have the ‘Apple LLVM 3.0 compiler’ selected in your build settings under the “Build Options” section. To open the project settings page, first go to the project navigator pane by clicking the folder icon on the toolbar, then select your project. You should see the project settings page, to open all settings use “All” sub-tab under the “Build Settings” tab. Here is a screenshot that can help you out –

    Enabling Apple LLVM Compiler 3.0

  • Now we need to enable the ARC. Scroll down more until you can get the section name “Apple LLVM Compiler 3.0 – Language” section. Now go to the 17th item and set “Yes” for its value. Here is a screenshot to help you –

    Enabling ARC

Hope this was helpful for some of you. If it does, posting a ‘thank you’ does not cost too much time, does it? .. 🙂

Advertisements

About Mahmudul Islam

Senior Software Engineer Sitback Solutions (https://www.sitback.com.au/)
This entry was posted in IPhone, Mobile Developement and tagged , , , . Bookmark the permalink.

5 Responses to How to enable Automatic Reference Counting (ARC) in XCode 4.2

  1. Oops, I forgot to mention one thing. You will need to run the XCode refactor tools to convert all your files to be ARC compatible. The tools is located at Edit > Refactor > Convert to Obejctive-C ARC…

    Like

  2. to'c says:

    Thanks! Oddly enough I did the Convert t Objective-C ARC step first and it didn’t start complaining until I switched ARC on.

    Like

  3. Yonas says:

    thanks!! finally able to debug my program. I’m new to this and the book I used doesn’t tell about changing this ARC setting to Yes, and resulted in “error syntesizing weak properties only available in ARC mode”

    Like

I would like to say something ...

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