Question

I'm aware that with Xcode now, it is recommended to use ARC, however I've read a bit about it not being compatible with iOS 4.x, at least when using __weak. When I create an IBOutlet it gives the choice of weak or strong as the storage type, does this mean my application is limited to iOS 5 or above, or will it still run on an older iOS?

Was it helpful?

Solution

Definitely just use ARC. As you point out, if you elect to provide iOS 4.3 compatibility, you don't enjoy that one little benefit feature of weak variables, where they'd be automatically nil-ed for you when they're deallocated (but you don't have that feature in non-ARC code, so it's not like you're losing anything). And, yes, when you control-drag from Interface Builder to the .h file, it says you have only the strong and weak options, but in the latest Xcode, at least, if you have iOS 4.3 as a target and you choose weak, it will automatically create it for you as a __unsafe_unretained, so all is good.

In short, use ARC, even if you're targetting support for iOS 4.3, and your coding life will be considerably better than if you didn't use ARC. Even in iOS 4.3, you get so many wonderful ARC benefits. And if you are willing to use iOS 5.0 as your target deployment, then you enjoy the full benefits of ARC.

If you use Xcode 4.5, you do, admittedly lose support for armv6, the processor for the iPhone 3G and earlier, so your app will only support the iPhone 3GS and later.

OTHER TIPS

No, ARC is just compiler feature. It's per file, so it wouldn't impact your existing code at all.

iOS version support depends on your Xcode version.

With the last version of Xcode (4.5) you can create apps for iOS 4.3 and higher. If you need to create apps for earlier versions of iOS (prior that 4.3) you need to install Xcode 4.4.1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top