Are Your (Older) Apps Ready for iOS6?

I would hope this is obvious to anyone who’s been around the iOS eco-system during an iOS beta period: Make sure your apps will continue to work with the new release!

Last week I tweeted this:

The message was clear: Now is the time to smoke-test your existing apps using the available (to developers) iOS6 beta and/or iOS6 simulator.

Of particular concern should be older apps built from templates in the iOS2 or iOS3 timeframe. When I built one of my apps and ran it in the iOS6 simulator, the app ran, but I saw this error in the debug window:

2012-08-01 08:27:43.166 …..[75421:19d03] Application windows are expected to have a root view controller at the end of application launch

The issue stems from (old) template code with the following boilerplate (or similar):

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    [window addSubview:[rootViewController view]];
    [window makeKeyAndVisible];

    return YES;

The fix is simple. Just one additional line of code is required in the above method. I put it first:

    window.rootViewController = rootViewController;

For applications that use only portrait mode, this problem is not surfaced to the user as the app runs. However, if your app has any landscape views, they will not appear correctly. To wit, another of my old apps which has only landscape views, before being fixed:

By the way, if you recognize this app, and you are a user and/or a fan, I am planning to have it updated before iOS6 goes live. :-)

In another app, the main view was portrait, but the app allowed for the device to be rotated to landscape and presented a landscape view. With this problem, the landscape view didn’t even appear, as if the message that the device had been rotated was not delivered.

The aforementioned one-line addition fixes these problems. The issue seems to be that with no defined rootViewController on the main window object, device orientation cannot be communicated to underlying view controllers. Once the window’s rootViewController is properly set, the problem is fixed.

More current application template code does not suffer from this issue, it seems.

It’s always a good idea to check your apps when a new major version of iOS is coming out, not only for SDK issues (deprecated methods, modified structures, and whatnot), but also because the compiler might have changed. Other small issues I found in some of my apps had to do with more strict type checking for both variable assignments and parameter passing. And while a lot of these kinds of problems appear as warnings in Xcode, it’s always a good idea to clean up these things in your code for “good hygiene.”

With probably about 6 weeks or so until iOS6 becomes generally available (according to MacRumors and other sources), there is still plenty of time to make sure your users will not have a nasty surprise when they run your (old) apps.

Posted in: iDevBlogADay, Software Development


  1. Dennis says:

    Have you tested those same apps on iOS 6 but using the App Store version instead? Anytime you build with a newer SDK, you are agreeing to the new terms of the API — but if you built against an older version, it is up to Apple to maintain backwards compatibility (assuming that the original program followed the original terms, that is).

    I wouldn’t want to discourage anyone from updating their apps to newer versions using the latest SDKs, but at the same time, a new iOS release shouldn’t require new builds of all the apps. If an older app that worked fine under iOS 5.1 stops working under 6.0, a bug should be filed against iOS 6.

  2. Hi Dennis. No, I have not tried the app store versions of my older apps on a device running iOS6 yet, but that’s a good suggestion. While I would tend to agree with your thought about backward compatibility of apps built against older SDKs under newer iOS versions, I am cynical, and think it better to be safe than sorry. :-) Plus, it never hurts to update your app and let your users know that it works on the latest and greatest SDK.

  3. Doug Davies says:

    I had the same problem with auto rotation if I didn’t set the rootViewController. My App Store app worked fine but when I rebuilt with iOS 6 it did not.

  4. Great data point, and confirmation of previous comment. Thanks!

  5. Great post. Thanks for the heads up on this. I tried a couple of our older apps (Euchre HD and Picross HD) and sure enough they both had the same problem. I’m still trying to figure out the right way to fix it. I’m also having some assert issues with GameCenter login via landscape mode right now.

  6. I can confirm that apps built against older versions of the SDK function correctly in iOS 6.

  7. Kyle Simmons says:

    I’m having the same problem. I installed xcode 4.5 this afternoon and now my app is having issues. But the above solution does not work for me.

  8. Patrick Varley says:

    Thanks Hawk, I’m new to app development. Was going crazy trying to figure out why my perfectly working (on previous xcode) landscape app would not fit the screen or rotate in the update. What a find to stumble onto your tip! Disappointed that Apple did not email me of this problem and fix. I know their must be dozens of developers out there pulling their hair out. BTW it might help to put in that the fix goes into AppDelegate.m, for us less experienced to Xcode. Also is this an IOS problem or the new Xcode problem?

  9. This is not an Xcode issue. Rather it is an “issue” now because the SDK is more strict in this particular regard.

  10. This is not a help forum, but can you provide more info about the specific issues you’re facing?

  11. dylan says:

    I was having the same problem. Another solution where you don’t have to type any code is to just go to
    – MainWindow.xib (or whatever it’s called)
    – Click Window
    – Connect rootViewController to the UIViewController you want to use as default

  12. Eugene says:

    You’ve saved my sanity, thank you! All of a sudden my iPad apps started doing it after upgrading and rebuilding (iOS6). I was going crazy. You should post it to stackoverflow and get full credit!

  13. Rob says:

    Thanks for sharing this info. After scouring the web and trying many solutions, yours worked for me.

  14. Vallard says:

    Thanks. I just found this doing a google search and was able to fix my iOS6 problem. Really appreciate people like you taking time to write this down. How did you figure out this was the way to solve it?

  15. Glad the post helped you out. I compared the code in question (which was quite old, circa iPhone OS 3) to current templates. Plus, the error was fairly explicit and gave a good clue.

  16. Brandie says:

    Thanks so much for the info, you saved me a headache! I used the tip about connecting the rootviewcontroller to the main nib. This quickly solved my error. It might be worth updating your post to include that solution, since it was so easy. Again, thanks so much!

  17. Chunyu says:

    This one actually works. There are so many ppl asking the same questions and none of the solutions online works for me. But, this one nailed it for me.
    Many thx.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove you are human: *

Read previous post:

Two things happened recently that have each, in their own way, de-railed me to some extent. The details of each...