50

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.

Philipp Schlösser
5,2492 gold badges40 silver badges52 bronze badges
asked Oct 20, 2011 at 13:55
3
  • In the window where you are looking for the ARC Key-Value pair: Have you thought about setting the filter to 'all'? Commented Oct 20, 2011 at 14:02
  • YES, I want to disable it for the project. I create the project use the old Xcode, and now I open the project with newest one, I think I can set the ARC off/on .Maybe I am wrong. Maybe only the newest xcode4.2 create the project and have the ARC off/on switch。 Just my think I will have a try。 Commented Oct 20, 2011 at 14:41
  • No, my project was created with Xcode 3 and it has the switch. However, if you did not turn on ARC in the first place, you don't have to turn it off. You probably need to use "Convert to Objective-C ARC" to turn it on the first time. If you did not do this, there is nothing to turn off :) Commented Oct 20, 2011 at 18:13

3 Answers 3

109
  • 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).

PAT
5075 silver badges13 bronze badges
answered Oct 20, 2011 at 18:33

2 Comments

OK, I get the point now. I can't find the item because I create the project with old xcode4.1 and open wit the new xcode4.2. Only the new xcode4.2 create the project that can find the item.
If you mean 'Objective-C Automatic Reference Counting' it should be in the 'Apple LLVM 3.0 Compiler Language' group.
1

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.

answered Oct 20, 2011 at 18:34

2 Comments

Converter still there Edit->Refactor->Convert to Objective-C ARC... (On current Build 4D199)
Also... I have a mac app I'm working on that IS using ARC. I just checked.
0

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]

answered May 17, 2021 at 20:50

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.