How to present UIImagePickerController or open the Camera in a Landscape-only app?

user1960279 picture user1960279 · Jan 25, 2015 · Viewed 7.1k times · Source

I am creating an application that only works in landscape mode.

During sign up I want to open the camera or present a UIImagePickerController, but the app is crashing with the following error:

*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'

How can I present an Image Picker or Camera in Landscape?

Answer

user1960279 picture user1960279 · Jan 25, 2015
I found solution, case closed. i add in my appdelegate.m:

-(NSUInteger)application:(UIApplication *)application 
    supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        return UIInterfaceOrientationMaskAll;
    else  /* iPad */
        return UIInterfaceOrientationMaskAllButUpsideDown;
}