iOS 8.3支持的方向崩溃

Ann*_*565 7 objective-c uiinterfaceorientation

我的应用程序和iOS 8.3存在很大问题.我有很多崩溃,总是出现同样的错误:

由于未捕获的异常'UIApplicationInvalidInterfaceOrientation'而终止应用程序,原因:'支持的方向与应用程序没有共同的方向,并且[... shouldAutorotate]返回YES

当"......"是很多班级时.一个特殊的问题是类UIAlertView,我在iOS 8.3中遇到UIAlertView崩溃的同样问题, 但我无法解析子类UIAlertView(Apple说UIAlertView类打算按原样使用,不支持子类化)或使用UIAlertController.你能帮助我吗?

Dep*_*o B 6

许多其他应用程序没有崩溃这个错误,所以我想知道我们的应用程序中是否还有其他因素导致此崩溃.我确保iOS 8将获得UIAlertController,因此它不会崩溃,但这对第三方框架没有帮助.

我们团队的另一位工程师最终通过这样做修复了它:

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
    // This used to be:
    //return UIInterfaceOrientationPortrait;
}
Run Code Online (Sandbox Code Playgroud)

  • 谢天谢地,这个答案!我有完全相同的问题. (2认同)

mke*_*kin 2

我不知道从 iOS 8.2 到 8.3 发生了什么变化以及他们为什么改变它,因为它运行得很好。它很烦人。

无论如何,我用链接上的要点解决了这个问题。

https://gist.github.com/mkeremkeskin/0ed9fc4a2c0e4942e451