我們有一個應用程序,它使用連接到音頻插孔(或iPhone7或更高版本中的閃電端口)的附件。它需要以某些方向運行,具體取決於iOS設備。無法將界面方向旋轉爲iPhone上的肖像倒置X
目前沒有任何問題在模擬器或實際設備中爲任何iPhone設置設備方向,但iPhoneX模擬器除外。
當前設置方向代碼:
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
//device checks omitted
return UIInterfaceOrientationMaskPortraitUpsideDown;
}
Target settings with orientations enabled
堆棧跟蹤:
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模擬器。它似乎不是iOS11的問題,因爲我的iPhone7目前正在運行iOS11。我目前唯一遇到的問題是iPhoneX模擬器。
在iOS 11.2上,不應再調用shouldAutorotate。在UIViewController的文檔中,所有舊的旋轉代碼似乎都被棄用:「截至iOS 8,所有旋轉相關的方法都被棄用」。我很難在這方面嘗試阻止在iPhone X上旋轉。 – RickJansen