UIImagePickerController crash in iOS6, iPhone4S

The preferredInterfaceOrientationForPresentation method will rotate your view to whatever you set it to when a view is loaded. Be careful as when you come back to your view it may be upside down. Do not include this method if you don’t want it to override the current orientation when you dismiss say a UIImagePickerController.

UIImagePickerController crash

 Crash:

Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’

 Add to app delegate:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)w {

return (NSUInteger)[application supportedInterfaceOrientationsForWindow:w] | (1<<UIInterfaceOrientationPortrait);

}

原文地址:https://www.cnblogs.com/easonoutlook/p/3083026.html