Advertisements

Interesting Issue with iPods and Launching Your iOS App


This isn’t documented anywhere that I can tell but here’s what was happening.

I was testing a¬†universal¬†iOS app that I was working on and decided to just use the iPod Touch (iOS v4.2.1) I had out at the time. Unfortunately when I’d launch the app a black screen would appear with the standard status bar and nothing else. I put a breakpoint in application:didFinishLaunchingWithOptions and found that it wasn’t getting called. Strangely the app worked fine on my old iPhone 3g (iOS v4.2.1). I put the iPod aside and decided to come back to it later. Well today was later.

After playing around getting the app ready to submit to the app store I discovered that the same issue was appearing on my iPhone. After futzing around with it for a little bit I realized that I had deleted the “Main nib file base name (iPhone)” key from the application’s plist file. I restored the setting telling the app to launch “MainWindow_iPhone” and all was well but that got me thinking that maybe I didn’t test this properly on the iPod. I tried launching the app on the iPod and still no dice. I figured I was on the right track so for fun I added the “Main nib file base name” key into the plist file and set it to “MainWindow_iPhone”.

MAGIC!

So the end result is the app works on all devices now and I have three “Main nib file” keys in my plist. One for iPad, one for iPhone and one generic one.

Advertisements