Orientation error: "Supported orientations do not have a common orientation with the application, and shouldAutorotate returns YES"

I am trying to force orientation using this code.

-(BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } 

What happens is viewing the downloads in the simulator in landscape mode, and when I rotate it to the portrait, the application crashes and I get this error 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES' . I would like that when you turned him into a portrait, he stayed in the landscape and did not crash. The supported orientations are in the info.plist

+4
source share
2 answers

Should you try to return NO in shouldAutorotate?

+6
source

You tried

 -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait; } 
+1
source

Source: https://habr.com/ru/post/1500782/


All Articles