How to enable/disable ARC in an xcode project?

Objective CXcodeAutomatic Ref-Counting

Objective C Problem Overview


If a project has already been created with ARC disabled, how do I enable it and vice versa?

Objective C Solutions


Solution 1 - Objective C

Open your project and select Edit -> Refactor -> Convert to Objective-C ARC. This will start checking your code if it is ready for the conversion.

See also Clang documentation: Objective-C Automatic Reference Counting (ARC)

How to disable ARC has been answered here

Solution 2 - Objective C

Following are the steps which I did and it worked for me

  1. Select Project
  2. Select Targets
  3. From the right panel, select Build Settings
  4. Search for "Automatic Reference Counting";
  5. Locate Apple LLVM compiler 3.0 - Language and Objective-C Automatic Reference Counting and select NO in all three sections.

enter image description here

Solution 3 - Objective C

When you migrate a project to use ARC, the -fobjc-arc compiler flag is set as the default for all Objective-C source files. You can disable ARC for a specific class using the -fno-objc-arc compiler flag for that class. In Xcode, in the target Build Phases tab, open the Compile Sources group to reveal the source file list. Double-click the file for which you want to set the flag, enter -fno-objc-arc in the pop-up panel, then click Done.

Solution 4 - Objective C

In Xcode 5.0.2, select your project in Navigatior, select Build Settings, search for Apple LLVM 5.0 - Language - Objective C and change Objective-C Automatic Refence Counting to NO

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionhollow7View Question on Stackoverflow
Solution 1 - Objective CMorotharView Answer on Stackoverflow
Solution 2 - Objective CAshishView Answer on Stackoverflow
Solution 3 - Objective CSnowboardBruinView Answer on Stackoverflow
Solution 4 - Objective CrhalgravezView Answer on Stackoverflow