我们有一个应用程序,它利用连接到音频插孔的附件(或 iPhone7 或更高版本中的闪电端口)。它需要在某些方向上运行,具体取决于 iOS 设备。
目前,除了 iPhoneX 模拟器之外,在任何 iPhone 的模拟器或实际设备中设置设备方向都没有问题。
当前用于设置方向的代码:
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInteceOrientationMask)supportedInteceOrientations
{
//device checks omitted
return UIInteceOrientationMaskPortraitUpsideDown;
}
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 'UIApplicationInvalidInteceOrientation', 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 模拟器。
iPhone X 似乎不支持倒置方向;请参阅https://forums.developer.apple.com/message/268015。一位苹果员工说:“这是设计使然。我们将在未来的版本中更新文档以反映这一点。”
你仍然得到方向改变通知,至少在 SIM卡,但你发现,如果你采取行动,可能会发生坏事。
我正在添加代码来检测倒置的 iPhone X 并防止 UI 重绘;它在 sim 中工作,我们将不得不等待,看看它是否会在真正的设备上工作(幸运的是,我的用例倒置只涉及耳机插孔设备,所以 iPhone X 上的倒置损失对我来说并不是什么大问题)。
结果是,我们这些使用想要在顶部的照明端口传感器的人将无法为 iPhone X 用户提供与“较小”iPhone 相同的可用性,至少不是没有一些非常繁琐的 UI 游戏,涉及大量仿射变换旋转和 / 或翻转元素以出现颠倒,同时仍然符合手机认为它是在做什么。
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(16条)