Giving kudos to this SO post - https://stackoverflow.com/a/32171894 for giving me the idea. I happened upon this crash in my app and I used the approach outlined there to keep my app fixed in landscape while allowing the SKStoreProductViewController to be presented in portrait. It's not the perfect experience when on an iPhone, the SKProductViewController will present in portrait although the screen launching it will be in landscape. For me this experience is better than a crash.
In you AppDelegate file:
(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window {
if (UIDevice.isPad) {
/* I have `isPad` in a Swift extension as a computed class var on UIDevice -
`current.userInterfaceIdiom == .pad`*/
return UIInterfaceOrientationMaskAll;
} else {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
Then in your base view controller use:
(UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
It's working perfectly for me and no more crash! Hope it helps someone even though the original question is from a year ago.
Topic:
App & System Services
SubTopic:
Core OS
Tags: