iphone - iOS 7 Landscape only 应用程序无法访问照片库

标签 iphone ios objective-c ios7

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

我遇到以下错误,

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`

当我启用纵向模式时,一切正常,但我不想启用纵向模式。解决方法是什么?

最佳答案

是的,我在一个应用程序中有类似的问题

您可以为应用程序添加纵向模式支持,但限制所有其他 View 仅支持横向, 模式,然后图像选择器将工作

UIImagePickerViewController 仅适用于纵向模式

要限制其他 View 仅支持横向模式,请在 View Controller 中覆盖 - (NSUInteger)supportedInterfaceOrientations

- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}

关于iphone - iOS 7 Landscape only 应用程序无法访问照片库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18998607/

相关文章:

iphone - 基于单选按钮的 iOS pickerview 值更改

ios - UITableViewCell 中的 UITableView 委托(delegate)和数据源

ios - Xcode 6 Beta 6 上的 iPhone 5c 配置

ios - UISearchBar 上方的 UITableView 背景颜色

ios - 如何知道哪个 UITextField 正在响应?

iphone - 从 UIBarButtonItem 获取 UIBarButtonSystemItem

ios - 通过一个ViewController控制多个子ViewController 'root'

ios - 找不到支持 10 型键盘 iPhone-Portrait-Emoji 的键平面

objective-c - 如何访问 UITextField 的 selectedTextRange UITextPosition 对象的属性?

iphone - 子类 NSString