我们有一个应用程序,使用连接到音频插孔(或iPhone7或更高版本的闪电端口)的附件。它需要在特定方向上运行,具体取决于iOS设备。
目前,在任何iPhone模拟器或实际设备上设置设备方向都没有问题,除了iPhoneX模拟器。
设置方向的当前代码:
目前,在任何iPhone模拟器或实际设备上设置设备方向都没有问题,除了iPhoneX模拟器。
设置方向的当前代码:
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
//device checks omitted
return UIInterfaceOrientationMaskPortraitUpsideDown;
}
堆栈跟踪:
TF uncaught exception reason : Supported orientations has no common orientation with the application, and [RootNavigationController shouldAutorotate] is returning YES
2017-10-05 09:35:02.692945+0200 [65045:74145368] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RootNavigationController shouldAutorotate] is returning YES'
这段代码在 iPhone5、iPhone6、iPhone6+、iPhone7 和 iPhone7+ 上运行良好,并且可以在 iPhone8 模拟器上运行。当前我的 iPhone7 正在运行 iOS11,因此看起来并不是 iOS11 的问题。唯一出现问题的设备是 iPhoneX 模拟器。