The iPhone 5 is looking like it will be the fastest-selling gadget of all time. So let’s talk about what you need to do to prepare your Corona apps for the iPhone 5 and iOS6. One of the biggies we’ll cover is what you’ll need to do to make your Corona app handle the new 16:9 aspect ratio, or what we’re calling “tall apps” (as opposed to the shorter “traditional apps” designed for the iPhone 3 and iPhone 4).
First thing’s first. You need to install XCode 4.5 SDK GM seed that Apple made available this past Wednesday. If you have previous installations, you’ll need to download this newest version. This will allow you to submit iOS 6 apps to the iOS App Store. This will also allow you to preview your app in the XCode simulator on the “iPhone (Retina 4-inch)”, a.k.a. iPhone 5.
Updates to Corona
We’ve made some key updates to allow you to target iOS 6 and iPhone 5 successfully. Subscribers can get access to this update by downloading daily build 912
911 (Note: it’s currently building right now).
Starting in daily build 911, device builds should be built using ‘XCode 4.5 GM seed’. Be sure to select “6.0 GM seed” (not 5.1″) explicitly in the build dialog as shown in the image at right.
Apple plans to release the final GM early next week. At that point, we’ll be removing the ability to target iOS 5 specifically. All future builds will target iOS 6 and be backwards compatible to iOS 5.1 (and maybe 4.3).
We’ve also added an iPhone 5 skin to the Corona Simulator. This is available to both Mac and Win users. If you are designing a “tall” app, you should use this skin. If you are designing a traditional app, you should use the iPhone 4 skin.
(Enterprise customers: we plan to update the Enterprise daily builds with the final iOS 6 GM that Apple is releasing next week.)
iPhone 5, Duck Typing, and the Black Bars
If you watched Apple’s keynote, you’ll notice that existing apps that run on the iPhone 5 will be letterboxed, i.e. the “black bars”.
How does this work exactly?
Based on our investigation, something different is happening than how iPhone apps work on the iPad. Existing iOS apps (e.g. those compiled against iOS 5) will be treated as traditional apps by iPhone 5.
This means, for all intents and purposes, the iPhone 5 will behave as if its screen is 320×480 points (640×960 pixels) in size. Everything follows from that. For example, the status bar will appear below the black bars, iOS will tell Corona that the screen is shorter than it truly is (the traditional 320×480 points), and no rendering or touches will be allowed in the black bar region (it doesn’t exist as far as your code is concerned).
It’s similar to duck typing:if it walks like a duck, talks like a duck, and acts like a duck, well then by golly it is a duck! This is the sleight of hand, Apple is playing on apps to make it easy on developers. If you want your app to think it’s on the same ol’ traditional iOS device, then just go merrily along.
Supporting “tall” apps
As some of you have already noted in the forums, it turns out there is a special file you add to your project. This makes the iPhone 5 magically run in “tall” mode. What you need is a new “tall” splash image called “Defaultemail@example.com”.
There are several caveats to be aware of:
- You MUST build against iOS 6.0 GM. Apple has tested their “tall” apps (e.g. Mail, Safari) on iPhone 5 using iOS 6, and not iOS 5 (. If you somehow find that you can get an iOS 5 build to work in tall mode, you’re pressing your luck. Apple won’t support that, so neither will we. In any case, Corona apps you build that target iOS 6 will still be backwards compatible to earlier versions of iOS.
- The XCode simulator is finicky when you start playing with tall mode. You may notice that even if you remove the tall splash image, for example, your app still behaves in tall mode, even if you want it to run in traditional mode. If you want to switch between tall and traditional, you must uninstall the app (i.e. delete it from within the simulator) or reset the simulator via the “Reset Content and Settings…” menu. You may also need to do “clean” builds, e.g. deleting previous builds of the .app bundle file sitting on your Mac.
- We fixed a touch issue where began and ended touches on the bottom portion of the iPhone 5 weren’t getting dispatched.
Coexistence of tall and traditional apps
Now, Apple being Apple, they are going to want your iOS app to work on all supported iOS devices, not just iPhone 5. That means, you’ve got two choices:
- Easy: only support “traditional” screens. This is by far the easiest. It’s what you’re used to, so not much changes here.
- Harder: support both “tall” and “traditional” screens. This is trickier. You’ve got to create a UI that works on both the taller screen when your app runs on the iPhone 5 and the traditional screen when your app runs on older devices.
Scenario #1 is easy, so I won’t comment much there. Scenario #2 is more work because you have to design your interface carefully to accomodate the extra screen space. To make Scenario #2 work, we realized you need some more information from Corona to write your code properly. We’ve added some new API’s to help you detect whether you’re running on a taller screen. The easiest check is to do the following:
You can then customize your interface based on whether it should be tall or traditional. Now if you’re lucky, some of the images you created were already designed for some of the taller Android devices. If not, then you should think carefully about whether it’s worth the effort to upgrade your existing apps to support “tall” mode.
* * *
As you can see, we’ve been furiously analyzing every last detail.
As one of our developer’s describes our industry, “It’s never a dull moment.”
Amen to that!