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? .. 🙂