I have a xib file who enter in the gallery to pick some photos, and I define in my project he will support only the orientations LandscapeLeft and LandscapeRight, so when I click on my button and open the image gallery my application crash and send me a message:
Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES
Doing a quick search on the internet, I discovered that he could use the commands:
-(BOOL)shouldAutorotate {
return NO;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
I put this code inside .m file, but doesn't work! and I keep getting the error message, and the application crashes. So I would like to know if is mandatory, the device is in portrait position when we access the photo gallery, if not, how I can solve this problem?