我的应用程序仅在横向模式下运行!所以我知道UIImagePickerController
只在纵向模式下呈现,所以在 iOS 6 中,我创建了一个UIImagePickerController
强制UIImagePickerController
以纵向模式打开的子类:
@interface NonRotatingUIImagePickerController : UIImagePickerController
@end
@implementation NonRotatingUIImagePickerController
- (BOOL)shouldAutorotate {
return NO;
}
@end
//presenting picker controller :
UIImagePickerController *ipc = [[NonRotatingUIImagePickerController alloc]init];
ipc.delegate = self;
[self presentViewController:ipc animated:YES completion:nil];
这在 iOS 6 中运行良好,但现在在 iOS 7 中,我的应用程序确实因为以下原因而崩溃:
2013-10-31 14:56:01.028 Medad[1731:60b] *** Terminating app due to
uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason:
'Supported orientations has no common orientation with the
application, and shouldAutorotate is returning YES'
Portrait
如果我签入部署信息,
则可以解决此问题:
问题是,如果我选中此选项,我的应用程序也会纵向运行,但我不想要它!
我该如何解决这个问题?