gpt4 book ai didi

ios - 为什么 iOS 11 : self. performSegue() 不工作?

转载 作者:搜寻专家 更新时间:2023-10-31 22:56:10 24 4
gpt4 key购买 nike

我今天开始迁移到 Xcode 9 和 iOS 11 版本。

在我的基于故事的应用程序中,以下代码:

self.performSegue(withIdentifier: Const.UI.Segue.showIntro, sender: self)

在所有以前的 iOS 中运行良好(刚刚通过 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

预期结果:推送新 Controller

iOS 11 的实际结果:什么都没有发生

任何想法可能是什么原因?

函数 handleSuccessfulLogin() 在使用 AWSCognito/AWSFacebookSignInProvider 成功登录后调用,这是一个 facebook 登录。在 iOS 上有一个新的弹出窗口 continue with facebook 我怀疑这是原因,但我没有办法验证它..在第二次调用时,这个弹出窗口没有出现(因为 facebook 已经被授权),然后 segue 正确触发。

请注意,我也试过这个片段,结果相同。

OperationQueue.main.addOperation {
[weak self] in
self?.performSegue(withIdentifier: Const.UI.Segue.showIntro, sender: self)
}

最佳答案

我发现解决方案在一个完全不同的地方(通常如此)。原因是我在 applicationDidBecomeActive 中有一个逻辑正在替换当前的 Storyboard(糟糕的方法!)- FB Kit 的额外弹出窗口导致我的容器 View Controller 的重新创建。因此,在执行 segue 的调用期间,我有 self.navigationController == nil

关于ios - 为什么 iOS 11 : self. performSegue() 不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46435413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com