iOS 6 shouldAutorotate: is NOT being called iOS 6 shouldAutorotate: is NOT being called ios ios

iOS 6 shouldAutorotate: is NOT being called


See if you are getting the following error when your App starts.

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

If so the way to fix it is by making the following change in the AppDelegate.m file (although there seem to be a number of answers how to fix this):

// Replace[self.window addSubview:[navigationController view]];  //OLD// With[self.window setRootViewController:navigationController];  //NEW

After this shouldAutoRotate should be correctly called.


When using UINavigationController as the basis for an app I use the following subclass to give me the flexibility to allow the top most child viewcontroller to decide about rotation.

@interface RotationAwareNavigationController : UINavigationController@end@implementation RotationAwareNavigationController-(NSUInteger)supportedInterfaceOrientations {    UIViewController *top = self.topViewController;    return top.supportedInterfaceOrientations;}-(BOOL)shouldAutorotate {    UIViewController *top = self.topViewController;    return [top shouldAutorotate];}@end


That method is not the correct way to determine that. The correct method is willRotateToInterfaceOrientation:duration:

The should rotate to orientation (as opposed to shouldAutorotate) method is deprecated and will no longer be called as of iOS 6, but it was not meant to be used the way you were using it anyway.

EDIT Response to repeated downvotes. Please explain why using the method I indicated is not an (to quote OP) "indication that a rotation is about to occur." The content of the question and the title are mismatched.