How to disable Xcode4.2 Automatic Reference Counting

XcodeIos5Automatic Ref-Counting

Xcode Problem Overview


Today, I have update my xCode to 4.2 version, And I want to disable the ARC, I also search with the google. but can't fix my problem. According the search results, In the target setting, I can't find the 'Objective-C Automatic reference counting' item, So have no chance to set it to NO. I find the item one by one, and also use the search field.

And one know the newest Xcode4.2 ,how to disable the ARC for the project, not for the specific file.

Thanks very much.

Xcode Solutions


Solution 1 - Xcode

  • Click on you project, in the left hand organizer.
  • Select your target, in the next column over.
  • Select the Build Settings tab at the top.
  • Scroll down to "Objective-C Automatic Reference Counting" (it may be listed as "CLANG_ENABLE_OBJC_ARC" under the User-Defined settings group),
  • and set it to NO.

This is on Xcode 4.2 (Build 4D199).

Solution 2 - Xcode

In Xcode 4.2 beta, there were 2 places per target that you could toggle the use of ARC... now there seems to be NONE.

Also, the "Convert to ARC" menu item seems to have disappeared.

Now, yes, I suppose that the ARC stuff was never meant for Mac Developers, as 4.2 beta was iOS only, but not exactly sure what Mac developers who did play with the ARC stuff in their Mac Apps are supposed to do now....

File Radar Reports. Wait for 4.3? redo the app? Edit the .xcode XML manually? Not sure.

Solution 3 - Xcode

Disable ARC or enable MRC

You should operate by C flags

//enable ARC
-fobjc-arc
//disable ARC
-fno-objc-arc

You have three options:

  1. Local - Compile Sources
  2. Global - OTHER_CFLAGS
  3. Global - CLANG_ENABLE_OBJC_ARC

[Under the hood]

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
Questionuser501836View Question on Stackoverflow
Solution 1 - XcodeNJonesView Answer on Stackoverflow
Solution 2 - XcodeAlex GrayView Answer on Stackoverflow
Solution 3 - XcodeyoAlex5View Answer on Stackoverflow