如何在iOS 10 Swift 3.0 Xcode 8.2中停止iPad中的横向旋转

Sub*_*ani 2 iphone ipad swift3 ios10 xcode8.2

我知道这是重复的问题,但我找不到这个问题的解决方案.我在Info.plist文件中设置了操作更改以停止旋转横向模式

Supported interface orientations (iPad)
Run Code Online (Sandbox Code Playgroud)

以上关键值保持只有肖像然后我在iPad上检查它工作正常,但当我在应用程序商店上传时,它给出错误如下

ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 
'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 
'UIInterfaceOrientationPortrait' in bundle 'com.example.demo'."
ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 
'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait' in bundle 'com.example.demo'."
Run Code Online (Sandbox Code Playgroud)

多任务支持需要横向方向我已经编写了以下代码来覆盖旋转方法但在屏幕旋转时不调用

extension UINavigationController {
    public override func supportedInterfaceOrientations() -> Int {
        return visibleViewController.supportedInterfaceOrientations()
    }
    public override func shouldAutorotate() -> Bool {
        return visibleViewController.shouldAutorotate()
   }
}
Run Code Online (Sandbox Code Playgroud)

并尝试在navigationController对象上设置直接值然后它给出错误:

只读属性不能赋值

Ind*_*ore 6

问题是您的应用程序支持multitasking需要所有界面方向.

要么支持所有方向,要么只检查以下标志

在此输入图像描述