SKStoreProductViewController breaks down into iPhone iOS 7 app

I have a universal landscape mode application. SKStoreProductViewController works great on iPad. But it crashes on iphone ios 7. Even I installed SKStoreProductViewController to display in portrait on iPhone.

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       NSLog(@"iphone portrait");
       return UIInterfaceOrientationPortrait;
   }
   else
       return [super preferredInterfaceOrientationForPresentation];
}

The SKStoreProductViewController shows in the portrait on the iphone iOS 7, but when I rotate the phone, it crashes. I got an error message:

* Application termination due to the uncaught exception "UIApplicationInvalidInterfaceOrientation", reason: "Supported orientations do not have a common orientation with the application, and shouldAutorotate returns YES"

Does anyone know how to solve a problem?
Thanks

+4
1

, NO, ViewController . :

SKStoreProductViewController -shouldAutorotate :

- (BOOL)shouldAutorotate {
    UIInterfaceOrientationMask applicationSupportedOrientations = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
    UIInterfaceOrientationMask viewControllerSupportedOrientations = [self supportedInterfaceOrientations];
    return viewControllerSupportedOrientations & applicationSupportedOrientations;
}
+7

All Articles