sleepwalkerfx sleepwalkerfx - 10 months ago 44
Objective-C Question

iOS 7 Landscape only app can't access photo library

I have a landscape only app and whenever I access the Photo library , app would crash (because

is trying to load in portrait mode). App works fine in iOS 5 and 6.

I'm getting following error,

Terminating app due to uncaught exception '
', reason: 'Supported orientations has no common orientation with the application, and
is returning

*** First throw call stack:
(0x2ff7ae8b 0x3a2746c7 0x2ff7adcd 0x3277337d 0x3277a4c5 0x3277a47b 0x327795b3 0x326fff3d 0x326ffd19 0x326ff609 0x326ff467 0x3270c153 0x3270bbd3 0x327b7f67 0x327b7d83 0x327afdf3 0x327af279 0x327aefe9 0x327aef7d 0x32700533 0x32387f43 0x32383767 0x323835f9 0x3238300d 0x32382e1f 0x3237cb4d 0x2ff45f71 0x2ff438ff 0x2ff43c4b 0x2feae541 0x2feae323 0x34be52eb 0x327651e5 0x8c439 0x8c3c0)

`libc++abi.dylib:` terminating with uncaught exception of type `NSException`

When I enable portrait mode everything works as usual but I don't want to enable portrait mode. What is the workaround for this?

Answer Source

yes, I have similar issue in an app

you can add Portrait mode support to app but limit all other views to only support landscape, mode, then image picker will work

UIImagePickerViewController only works on portrait mode

to restrict other views only support landscape mode, override - (NSUInteger)supportedInterfaceOrientations in your view controller

- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;