how to use UIImagePickerController in an app which support Landscape orientation only in iOS-6?

ios6, landscape, uiimagepickercontroller, uiinterfaceorientation

Solution

As @rocky said you have to add Potrait mode to your application to use `UIImagePickerController` Like this

or add this to your landscape only app delegate class

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    return UIInterfaceOrientationMaskAll;
}

and from Mr.Daniel's Answer i found a nice solution for your Landscape only App, as you need to support only landscape to your application, you just need to add a category for `UINavigationController` like this

@implementation UINavigationController (LandscapeOnly)

- (NSUInteger) supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}
@end

and add this to your viewControllers, it works for me.

Problem

I am developing an app which supports Landscape orientation only. It uses an `UIImagePickerController` to pick images and/or videos from the library. App is functioning fine in iOS-5 or before but it gets crashed when I try to present image picker controller.It gives the following message after crashing: * Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

Original source

Related problems