5

I am relatively new to iOS development, so after watching a bunch of WWDC videos announcing new awesome features for the iPhone SDK, I still got a few questions regarding their support for older devices. Specifically:

  • Do the new compiler features (such as literals support, auto-synthesize, etc) require iOS 6 on the target device, or can the new style code be deployed to iOS 5 devices?
  • Auto-layout for iOS, same question. Will it only be supported on iOS 6, or 5 as well? If it's 6 only, what kind of fallback are we expected to implement?

Would really appreciate if someone could clarify this for me, as I'm thinking about rewriting my older unfinished project and I would love to use some of that improved SDK functionality.

Arnold
  • 351
  • 3
  • 12

2 Answers2

3

My understanding is that features implemented by the compiler, such as object literals, can be deployed on older systems. Features that require support from the runtime or from new/modified frameworks, probably including auto layout, will require iOS 6.

It's trivial to figure out whether any given feature will work on iOS 5... just build a simple sample project that uses the feature and try to run it under iOS 5. I don't remember how the new auto-synthesize stuff fits in, for example, but you can certainly try it out.

Caleb
  • 38,959
  • 8
  • 94
  • 152
  • Auto-synthesize is handled by the compiler so it will probably work with iOS 5 if you use the new versions of Xcode. –  Jul 08 '12 at 19:15
  • Thanks for the advice. I’ve downloaded the Xcode 4.5 preview and will try to build and deploy a test app onto iOS 5 tonight. Will post an update here. – Arnold Jul 10 '12 at 00:44
2

So I’ve tried this out myself, by running a test app with some new SDK features in the iOS 5 simulator, and the findings are practically as expected though still somewhat disappointing.

The compiler features, such as literals and auto-synthesize, work fine and good. However, if the app tries to access an IB file that contains some auto-layout stuff, the app will crash with this error:

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'

So, although it’s not really surprising, it is now confirmed that auto-layout won’t work on iOS versions prior to 6. I don’t believe there have been any official recommendations on what to use instead and how to provide proper fallbacks, but I believe it’d have to be separate older-iOS-specific XIBs along with same good ol’ manual layouting code.

Arnold
  • 351
  • 3
  • 12
  • This is the kind of issue that mostly goes away over time. According to [one source](http://www.macrumors.com/2012/03/23/developer-sees-quick-adoption-of-ios-5-1-amongst-users/), about 80% of iOS users are on some version of iOS 5 now. Given the convenience of OTA updates, it seems likely that iOS 6 will be adopted quickly when it's available. – Caleb Jul 10 '12 at 15:03
  • @Caleb, yes it is true that the adoption rate of new iOS versions is generally pleasingly high, but it won’t be for at least another year before we can ditch the support for iOS 5 altogether. At most, we can only afford to stop fully supporting iOS 4, when the 6 comes out. – Arnold Jul 10 '12 at 23:20