Corona Guidelines: iPhone 5 and iOS6 (Preliminary)

Share on Facebook0Share on Google+4Tweet about this on TwitterShare on LinkedIn0

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

Okay, now what if you wanted to support the iPhone 5’s taller aspect ratio?

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 “Default-568h@2x.png”.

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:

  1. Easy: only support “traditional” screens. This is by far the easiest. It’s what you’re used to, so not much changes here.
  2. 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!

Share on Facebook0Share on Google+4Tweet about this on TwitterShare on LinkedIn0

This entry has 26 replies

  1. Great post Walter, thanks for the heads up and offering up a strategy for us!

  2. This is exactly what I needed, thank you! You say Apple will release a “final” GM next week, how will that differ from what’s out now? Should we wait for that?

    • Walter says:

      Apple is permitting app submissions using the currently available GM seed. However, they will be releasing a final GM between now and when iOS6 officially ships on the 19th. We don’t know what will change, but presumably there may be very minor bug fixes.

  3. Thanks for taking the lead Walter.

    Cheers for Corona Labs!

  4. Mitaten says:

    Great post Walter, thanks for the heads up!

  5. Mark says:

    Thanks for the post Walter!

  6. Thank you for the tips Walter! ๐Ÿ™‚

  7. Chris Leyton says:

    Hoping they fix the Game Center bug for apps designed to run in landscape orientation:

    Don’t think there’s much @Walter and the rest of the Corona team can do about that one????

    • Walter says:

      According to Apple’s own iOS release notes:

      “Landscape-only apps that invoke a portrait-only view controller (such as the Game Center login screen) will cause the app to crash.”

      In other words, it’s an Apple bug, which unfortunately your app will have to work around for the time being — this is discussed in the forum thread you referenced.

  8. Ernest says:

    btw, I use display.screenOriginX and display.screenOriginY to offset my UI elements as well as setting the scaling to scale = “letterbox” in config.lua for the iPhone 5 and all other devices to keep in consistant

  9. Nick Golden says:

    “All future builds will target iOS 6 and be backwards compatible to iOS 5.1 (and maybe 4.3).”

    I’m taking 3GS and under out of my targets. My game won’t run worth a damn on 3GS and on 4th gen iphone/ipod it gets low 30’s… (long story, but 500-700 vertexes make a device cry if it’s 4th gen or under)

    So this “maybe 4.3” thing, I sure hope the next stable build will work with that and up ๐Ÿ™‚ . I’ll renew my subscription when I get ready to push, but having that stable build will be key to a lot of people I’m assuming, since daily builds can be oddball at times.

    I pre ordered my iphone5 on verizons website at 11:51pm this past friday which was really ODD as I checked the time a few places and it was accurate. Strange, but whatever I pre ordered it……for full price to keep unlim data and migrate to 4G.


    • Walter says:

      The current daily build (919) is pretty stable since 894 was the last stable release (for Mac OS 10.8) and most of our subsequent changes have been for supporting iOS 6.

  10. MrB says:

    and maybe 4.3 ?

    I dont know about you
    but one of my goals is to sell as many apps as possible
    and there is many IOS owners that don’t update there device
    so if corona only will support 5.1 and up
    i will need to find a new SDK

    at least let the developer have the choice of supporting older versions
    ( maybe with less features )

    • Walter says:

      When you say “many IOS owners that donโ€™t update there device”, what data are you basing that statement on? All the data we’ve seen, including from Apple, indicates otherwise.

      BTW, if you said this about Android, I would agree with you.

      • MrB says:

        Hello Walter
        what i can see goggling the numbers is about 8-15% its hard to find a good source
        (please share your numbers)

        And for a indie developer 8-15% of the milions IOS devices around the world is a huge amount of potential customers

        Most indie apps will probably not be the next big thing and there for are these 8-15% very important

        Just because Apple don’t support older devices
        is bad business for indie devs to do the same

        And i think there is a lots of Corona apps that dont use all the latest extra functions the new IOS includes

        So please make it possible to compile for older devices

        Thank you

  11. +1 for keeping 4.3 compatibility!

  12. Dominic says:

    Not run any of this BUT really do appreciate the clear explanation that is pitched to all developers. It’s an important change which by the sound of the above you have handled and documented very well.

  13. Haakon says:

    Hi, when building our iPhone5 adapted app for the XCode Sim, it does not utilize the extra height. The app is shown as a regular iphone4 app.

    The simulator is returning display.pixelHeight as 960 instead of 1136. Seems like a bug in Corona.

    As always, it’s a showstopper. When will it be fixed?

  14. Haakon says:

    Fixed. This one was our fault -> we had used the wrong name on the splash image, missing the “h”.

  15. Nick Golden says:

    I’m waiting around for the next stable build release, not renewing my subscription until I am close to release ๐Ÿ™‚ so, I won’t be cool and have daily builds.

    I wonder when the next stable release will hit?


    PS. – for those who love bacon, you do know that there is an upcoming worldwide BACON shortage? I know, it’s tragic. You can google it, just thought you should know haha (cuz EVERYTHING taste better with BACON).

  16. finefin says:

    @nick yeah, who doesn’t enjoy his strawberry yogurt with a juicy slice of bacon? ๐Ÿ˜‰
    But there’s more urgent stuff to think about than “Peak Pork” – for instance: will Apple fix all those iOS6 issues within a narrow time frame or will we have to wait until the cows (or pigs) come home before we can release our game?

  17. Olivier says:

    Hi Walter
    thank you for this tutorial ๐Ÿ™‚

    – I’m currently used the latest version of CoronaSDK : 2012.935
    – I’ve got an iPhone 4 and I’ve just installed successfully iOS 6.0 on it.
    – I’ve just installed successfully XCode 4.5.1 on my Mac Book.
    – I carefully read your explanation.

    You specify this at the beginning : “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.”

    So, with the 2012.935 version:
    – I launched SDK simulator
    – I launched my app
    – then I selected File>Build>iOS
    – the “Build for iOS” pop up appeared..

    >> MY PROBLEM is that there is no “iOS SDK” line in the “Build for iOS” pop up which appears on my screen unlike the image of the pop up you put on your tutorial
    Did I miss something?

    Thank you for your help ๐Ÿ™‚

    • Andreas says:

      Hi Olivier,

      as Walter stated:

      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).

      After the final GM was released Coronalabs took out the iOS-switch, because now target is always iOS 6.


      • Olivier says:

        Thanks Andreas for your explanation ๐Ÿ™‚

  18. Nick G says:

    So how about a new stable build ๐Ÿ™‚

    Mmmmm Hmmm.

  19. Thank you for the nice posting. I hope the Ios 7 is better and stable than the beta.