iOS 7仅限横向应用程序无法访问照片库 [英] iOS 7 Landscape only app can't access photo library

查看:79
本文介绍了iOS 7仅限横向应用程序无法访问照片库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅限横向应用程序,每当我访问照片库时,应用程序都会崩溃(因为 UIImagePickerViewController 正试图以纵向模式加载)。应用程序在iOS 5和6中运行良好。

I have a landscape only app and whenever I access the Photo library , app would crash (because UIImagePickerViewController is trying to load in portrait mode). App works fine in iOS 5 and 6.

我收到以下错误,


由于未捕获的异常终止应用程序' UIApplicationInvalidInterfaceOrientation ',原因:'支持的方向与应用程序没有共同的方向, shouldAutorotate 正在返回'

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



*** 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?

推荐答案

是的,我在应用程序中遇到类似的问题

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 仅适用于纵向模式

限制其他视图仅支持横向模式,覆盖 - (NSUInteger)supportedInterfaceOrientations in您的视图控制器

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

- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}

这篇关于iOS 7仅限横向应用程序无法访问照片库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆