iOS 6 Tips and Tricks Upgrading Your Apps

Here is what I have learned so far upgrading our apps to iOS 6. Figure this will help some people out. Orientation support is instantly broken the minute I built my apps against iOS 6. 

Root View Controller warning?


Application windows are expected to have a root view controller at the end of application launch

 Change in app delegate didFinishLaunchingWithOptions:

[window addSubview:navigationController.view];


[window setRootViewController:navigationController];

iOS 6 New Orientation Methods

Set orientation in Info.plist or Summary screen. Then add following code to root view controller class only. Note that if you add a navigation controller to your window, in your app delegate’s didFinishLaunchingWithOptions, you need to create a class that has a subclass of UINavigationController and change your class to this type.

– (BOOL)shouldAutorotate {

return YES;


\\replaces – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

– (NSUInteger)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskLandscape;


– (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

return UIInterfaceOrientationLandscapeRight;


The preferredInterfaceOrientationForPresentation method will rotate your view to whatever you set it to when a view is loaded. Be careful as when you come back to your view it may be upside down. Do not include this method if you don’t want it to override the current orientation when you dismiss say a UIImagePickerController.

UIImagePickerController crash


Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’

 Add to app delegate:

– (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)w {

return (NSUInteger)[application supportedInterfaceOrientationsForWindow:w] | (1<<UIInterfaceOrientationPortrait);


Test for iOS Version

Here is the best way to test for iOS Version:

NSString *reqSysVer = @”6.0″;

NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

BOOL versionHigher = [currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending;

New iPhone 5 screen dimensions


Missing “Default-568h@2x.png” launch image

Once you create this file, the letter boxing will disappear. XCode will even ask you if you want it to create the file.

Depending on your screens layouts, you may just have to make sure your MainWindow.xib is set to Full Screen at Launch. Otherwise you may have to do specific layouts for just the iPhone 5.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

15 Responses to iOS 6 Tips and Tricks Upgrading Your Apps

  1. Summon says:

    Thx for the “Root View Controller warning?” tip! Have a nice day

  2. TWright says:

    Root View Controller warning is what I was looking for thanks! Make sure the space is between “window” and “set” if you copy paste that.

  3. grembe says:

    Sorry I’ll fix the code fragments. WordPress must have messed those up.

  4. Thanks for “UIImagePickerController crash”, have a nice day! 🙂

  5. Josh says:

    Another +1 for “UIImagePickerController crash”

  6. PCO says:

    Minor improvement. instead of (1<<UIInterfaceOrientationPortrait) use the UIInterfaceOrientationMaskPortrait

  7. Mutawe says:

    Another +1 for “UIImagePickerController crash”

  8. Divan says:

    Thanks for help with the view being flipped upside down when you dismiss the picker – it was driving me crazy.

  9. lara says:

    Another +1 for “UIImagePickerController crash”

  10. jaspreet singh says:

    thanx it is working for is very nice

  11. Carl says:

    Very nice…. it also corrected my rotation problem which nothing else did.

  12. Ares says:

    You. Are. It!


  13. low says:

    thnx for the help, man. Really saved my day

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s