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

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
  • 39,298
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