Question

I couldn't find in Apple's documentation (Cocoa Auto Layout Guide) what is the lowest iOS version that supports this feature, nor any posts related to iOS... maybe it only depends on Xcode version, and not on iOS version? I need to develop an iOS app that should be compatible from the latest iOS version down to 4.3

Thanks

Was it helpful?

Solution 2

Autolayout was introduced at WWDC 2012 and is supported starting on iOS 6. It'll definitely not work with iOS 4.3.

I strongly recommend you to think about if you really need to support iOS 4.3 these days. We're probably very close to have iOS 7 now and you'll be years behind (technologically speaking) supporting iOS 4.3. I understand apps that are currently supporting iOS 4.3, but I don't think it's a good idea do start developing an app now with iOS 4.3 support in mind.

OTHER TIPS

One way to find this out quickly is to set the deployment target of the XIB/Storyboard file directly. By default, it's set to the latest SDK version. Open the XIB/SB, and in the File Inspector (right panel), choose 4.3 (or whatever you like) as your deployment target.

Example of an illegal configuration

If Auto Layout is enabled, Xcode will show an "Illegal Configuration" error for that file:

Illegal Configuration Error

As you can see, it's iOS 6+ only. Auto Layout uses new APIs at runtime, so using the latest Xcode version does not help, and you cannot use Auto Layout conditionally in a XIB. You could, however, have separate XIBs for different system versions, but it sounds like a lot of (maintenance) work.

Setting the correct deployment target has another benefit: You will be warned if you use classes that have been introduced later than your deployment target.

Unavailable Class Error

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