Automatic Reference Counting Checkbox


I’m using Xcode 4.2 (build 4C199) on Snow Leopard(!), which should be the latest version as of this writing. In figure 2.3 there is a checkbox “Use Automatic Reference Counting”, which is checked in the figure, but missing in my version of Xcode. There is, however, a build setting called “Objective-C Automatic Reference Counting” under “Apple LLVM compiler 3.0 - Language”. I wonder if it is enough to just enable it there or wether there are more subtle implications. Moreover, why is the checkbox missing - because I’m on Snow Leopard?

There is indeed at least one implication, the empty project won’t build, because the automatically generated code uses [super dealloc] … is it possible that this issue is related to the “Window-Based Application” announcement for iOS5?


Unfortunately you will need Lion in order to build Mac projects with ARC; my guess is that that build setting checkbox will not do what you want. See this thread. Snow Leopard can build ARC on iOS 5 if you download the iOS 5 SDK, but not for Mac because it doesn’t have the 10.7 SDK.


Thanks for the quick answer Adam! I will try this at home, where I have Lion installed on my iMac. I was hoping to have that feature on Snow Leopard too, since to me it sounds like a “compiler-only” thing which should be pretty much portable across OS versions.


ARC has a little bit of runtime support, for weak references, which is why you can compile ARC on Lion and run it on Snow Leopard, but you don’t get the weak reference feature that way. The problem is just that the 10.7 (Lion) SDK isn’t available for Snow Leopard, and the SDK contains the compiler support. I haven’t looked but there may already be efforts underway to backport it to a 10.6-compatible compiler, like PLBlocks did for blocks.