Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orientation error:'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

I am trying to force orientation on a view using this code.

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

What happens is the view loads in the simulator in landscape and when I turn it to portrait the app crashes and I get this error 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'. What I would like to happen is that when you turn it into portrait it remains in landscape and doesn't crash. The supported orientations are in the info.plist

like image 586
user2649355 Avatar asked Sep 05 '13 17:09

user2649355


2 Answers

If you try to return NO in shouldAutorotate?

like image 82
Nico Avatar answered Nov 15 '22 01:11

Nico


Have you tried

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait;
}
like image 37
Vik Avatar answered Nov 14 '22 23:11

Vik