Using iOS 8.3
I have a view in landscape mode, and i'm trying to open a portrait only view controller. every time i try to open it, the app crashes.
I have read this official apple answer which basically recommends doing the following:
in the app delegate:
@implementation AppDelegate
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else /* iphone */
return UIInterfaceOrientationMaskAllButUpsideDown;
}
and in my controller:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
And so i have, and yet i still get this crash message:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES
In the project general settings i have the following (which should not be changed according to apple's answer):
I can see that these functions are in fact being called but nothing helps. Any thoughts?
Some questions i read earlier:
How to force a UIViewController to Portrait orientation in iOS 6
iOS6: supportedInterfaceOrientations not working (is invoked but the interface still rotates)