Converting a Hybrid Mobile Project to XCode 5 & iOS7

I had just a momentary lapse of reason the other day: after weeks of holding off on upgrading my iPad to iOS 7, I abruptly felt that I had been left behind. So, after double-checking that all our key enterprise features were supported, I made the leap. And then I went back to work.

On a project that was due the next day. And which I needed to be able to test on that iPad. Eeek. 

Because here’s what happens when you suddenly try to push an app to iOS 7 from XCode 4: nothing useful. You’ll just get a message that XCode doesn’t have libraries for the target device. It might have looked something like this:

Image

Oh, right. New iOS needs new XCode. OK. So, lesson 1: if you’re going to upgrade your target device, you need to upgrade XCode as well. 

Simple enough: App Store, run the install… OK. Open XCode, do a preemptive ‘Clean’ on the project, then hit ‘Run’.

<failure buzzer>

Nope. Because… things change, man. Turns out there’s some additional prep we have to do to migrate the project. Note that this project uses a custom UIWebView wrapper, but I believe that these steps would be the same for a PhoneGap/Cordova project, or any other hybrid mobile shell.

  1. lesson 2: iOS 7 and/or XCode 5 now enforces a requirement for a version number in order to do a local build, which we weren’t bothering to use on this prototype product. This is your problem if you get an error saying “Your bundle is invalid. The value for key CFBundleVersion in the Info.plist file must…” Simple solution: add the following 2 lines to the .plist (substitute whatever version # you like):
    <key>CFBundleVersion</key>
    <string>1.1</string>

    Once I fixed that, I could get it to build.

  2. lesson 3: the new floating status bar is a pain. Not fatal, but it sure was ugly. Christophe Coenraets provides an overview of the overlapping status-bar issue. In his case, he wanted to see it, but solve the spacing issues. We wanted to get rid of it entirely, and had already been hiding it in the iOS 6 version. For that, you need just two more lines  in your .plist:
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>

    EDIT: For additional super-valuable information about how to actually live with the status bar rather than hiding it entirely, be sure to see Everything Hybrid Web Apps Need to Know About the Status Bar in iOS7, at the Icenium blog. Their solution includes a relatively straightforward way to detect iOS7 and add manual margin that is otherwise implicit on older versions of the OS.

And with that, we were back up and running. Those two changes, btw, are fully backwards-compatible, and won’t interfere when running your app on previous versions of iOS.

Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: