当两个alert 一个接一个出现时,我指的是一个alert 出现,另一个alert 出现,应用程序崩溃.
请在这一点上帮助我.
当两个alert 一个接一个出现时,我指的是一个alert 出现,另一个alert 出现,应用程序崩溃.
请在这一点上帮助我.
This is a bug in iOS 9 that it failed to retrieve the supportedInterfaceOrientations
for UIAlertController
. And it seems it dropped to an infinite recursion loop in looking for the supportedInterfaceOrientations
for UIAlertController
(e.g., it tracks back to UIAlertControler
-> UIViewController
-> UINavigationController
-> UITabBarController
-> UIAlertController
-> ...), while the call to UIAlertController:supportedInterfaceOrientations
actually is not implemented/overridden in the source code.
在我的解决方案中,我刚刚添加了以下代码:
extension UIAlertController {
public override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Portrait
}
public override func shouldAutorotate() -> Bool {
return false
}
}
然后UIAlertController
将直接返回支持的方向值,无需无限循环.希望有帮助.
Edit: Swift 3.0.1
extension UIAlertController {
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
open override var shouldAutorotate: Bool {
return false
}
}