1

[ Old question title used to be ARC is set to YES, but xcode shows NO, edited in order to make the question clearer.]

I have an iOS project in xcode 4.2.1 using the iOS 5.0 SDK. The project is under version-control (using the built-in git interface), and one of the early commits was after I converted the project to use ARC. Since then all worked OK with some more commits etc.

Now I suddenly notice that the build settings from within xcode shows that the relevant option ("Objective-C Automatic Reference Counting") is set to NO. But when I check the project settings file project.pbxproj directly (either via the version control or just by opening it with a text editor) I see that CLANG_ENABLE_OBJC_ARC is set to YES.

Is this a problem I should worry about? The project compiles and runs OK.

EDIT

As Dondragmer pointed out, there is a separate flag for the project and for the target. Indeed for the project it was set to NO and for the target YES. What does it mean to have a separate flag for the project/target?

Itamar Katz
  • 9,544
  • 5
  • 42
  • 74
  • In my "native" ARC iOS app (created using ARC) "Objective-C Automatic Reference Counting" is set to "YES" in LLVM compiler language. However i have "Objective-C++ Automatic Reference Counting" set to "NO" in LLVM compiler 3.0 warnings. maybe you looked the C++ line by mistake. – moxy Apr 07 '12 at 21:36
  • Have you checked the ARC setting for both your Project and your Target? You could have it set to YES for the Project, but overriding to NO for the target. Or, it could be the other way round. – Cowirrie Apr 07 '12 at 21:39
  • @moxy: No, it's under the LLVM options. – Itamar Katz Apr 08 '12 at 07:11
  • @Dondragmer: Indeed, it is set to NO for the project, and YES for the target. Since I used the 'refactor' option to convert the project to ARC, I guess it is the correct settings (I mean, xcode knows what he's doing). What does it mean, to have this flag with different values for the project/target? – Itamar Katz Apr 08 '12 at 07:13

1 Answers1

3

The question is now apparently: "What does it mean to have a separate flag for the project/target?"

It isn't important unless you have multiple targets in one project. If you do, you can set common settings at the project level. (For instance, the base SDK, or whether ARC is turned on, or which compiler you're using.)

Then, in your targets, set only the few settings that need to be different.

This way, when you do want to change the base SDK, or change the compiler, you can do it in exactly one place, rather than changing every target. This can make large projects much easier to deal with.

Kurt Revis
  • 27,695
  • 5
  • 68
  • 74
  • Thanks. I've realized the question has changed, but I didn't know if it is a good SO practice to change the title completely (so I left it as is). – Itamar Katz Apr 08 '12 at 08:22
  • It would be OK (even helpful) to change the title if you have a better one, but it's definitely not required. – Kurt Revis Apr 08 '12 at 08:25