Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 997
user1960279 Avatar asked Jan 25 '15 07:01

user1960279


1 Answers

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;
}
like image 58
user1960279 Avatar answered Sep 19 '22 22:09

user1960279