我今天开始迁移到Xcode9和iOS 11构建。
在我的基于故事情节的应用中,以下代码:
self.performSegue(withIdentifier: Const.UI.Segue.showIntro, sender: self)
这段代码在之前的所有iOS版本中都可以正常运行(我已经验证了10.3、10.0和9.0),但在iOS 11上无法运行。
其他代码:
private func handleSuccessfulLogin() {
self.log.info("Logged In")
DispatchQueue.main.async(){
self.performSegue(withIdentifier: Const.UI.Segue.showIntro, sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
print("starting segue " + segue.identifier!)
}
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
print("should perform segue")
return true
}
打印输出 (iOS 11):
> Logged In
> starting segue showIntroSegue
期望结果:推送新控制器
iOS 11的实际结果:没有任何反应
有什么想法是原因吗?
在使用AWSCognito / AWSFacebookSignInProvider
进行成功登录后,将调用函数handleSuccessfulLogin()
,这是一个Facebook登录。在iOS上,会出现一个新的弹出窗口继续使用Facebook
,我怀疑这可能是原因,但我无法验证它。在第二次调用时,此弹出窗口不会出现(因为Facebook已获得授权),然后转换正确触发。
请注意,我也尝试过此片段,结果相同。
OperationQueue.main.addOperation {
[weak self] in
self?.performSegue(withIdentifier: Const.UI.Segue.showIntro, sender: self)
}
segue.destinationController
的值吗? - LarmehandleSuccessfulLogin
在主线程上调用吗?如果失败,您可能需要查看视图层次结构:https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/special_debugging_workflows.html#//apple_ref/doc/uid/TP40015022-CH9-SW2 也许它因为未知原因被隐藏了,或者是 FB 导致的问题... - Larmefunc handleSuccessfulLogin()
方法?当调用此方法时,您的当前视图是否已经加载和呈现? - holex