Full Screen iPhone 5 Layouts with iOS 5

UPDATE - 20120927

I just submitted another iOS 5.1 SDK app using the steps detailed below and received an auto-rejection for the following:

Invalid Launch Image - You app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later.

The grammatical error tells me that this is serious business.

Original Article

Keeping with Apple’s traditional secrecy surrounding new product launches, the average iOS developer received confirmation of the iPhone 5’s new screen size at the same time as the rest of the world: Apple’s September 12th media event. New developer documentation was released soon afterward and the twittersphere was abuzz with the Default-568h@2x.png file.

Unfortunately, the most obvious way to add Default-568h@2x.png is by downloading Xcode 4.5 and plugging the new image into the App’s Summary screen. This inevitably upgrades the application to the iOS 6 SDK. Normally this would not be a huge issue. However, as revealed in the UIKit section of the Release Notes, rotation has been significantly reworked in iOS 6.0. Rotation capabilities are now handled by the topmost ViewController in the stack (typically a UINavigationController) rather than on a per-ViewController basis like they were in 5.1. Perfectly functional 5.1 apps suddenly stop rotating or began rotating in unexpected screen configurations. Sketchy, swizzled ViewController fixes sprung up immediately.

Needless to say, this throws a wrench in plans to update and quickly submit an iOS 6 compatible version of an app.

Something struck me as odd about the enigmatic, file-existence based gatekeeper to 4-inch fullscreen. Perhaps the SDK version didn’t even matter? With only one way to find out, I reset my local git repo and reopened my project in Xcode 4.4.1. I dragged my new Default-568h@2x.png into the launch-images group in the Xcode project and fired up the 4 inch simulator from Xcode 4.5. One “Run in Simulator” later, my app was happily occupying the full screen of the iPhone 5.

Steps

  1. Install Xcode 4.5 and 4.4.1 side by side (I always rename my old /Applications/Xcode.app before installing a new version)
  2. Create an image named Default-568h@2x.png
  3. Add the image to your SDK 5.1 App’s project in Xcode 4.4.1
  4. Launch the iPhone 5 Simulator from Xcode 4.5 (Toolbar >Xcode > Open Developer Tool > iOS Simulator)
  5. Run your app with the Simulator selected in Xcode 4.4.1
    • It crashes on the first run on my box
  6. Switch the simulator to a different device (Toolbar > Hardware > Pick One)
  7. Switch the simulator back to “iPhone (Retina 4-inch)”
  8. Tap on your app’s icon

Your app should start up in full screen. I haven’t figured out how to debug in the simulator yet. (Update: debugging on the actual iPhone 5 works fine)

Caveats

  • My app’s layout is relatively simple. Mostly UITableViews with a couple custom Views and an iAd banner across the bottom. I use a single storyboard for iPhone and iPad so it was laid out using springs and struts with multiple screen sizes in mind. You may have a much more difficult time if your app is using hard-coded width and heights or uses a fancy layout framework.
  • Everything is working fine on my actual iPhone 5 but my App submisison is still “Waiting for Review”. I’ll update this post if Apple has any issues with this technique.
  • You should probably wait to test your updated code on an actual iPhone 5. I feel a little better knowing I did.
  • Don’t forget 4 inch screenshots in your App Store submissions.


comments powered by Disqus