本文介绍了虽然正在进行现有的过渡或演示;导航堆栈不会更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这样的警告:

尝试调用 navigationController?.popViewControllerAnimated(false)来自 UIAlertController 完成块。

推荐答案

此警告表示您正在尝试错误地使用 UINavigationController

This warning indicates that you are trying use UINavigationController wrongly:

您在评论中提到您试图 pop
ViewController 使用

You mentioned in the comments that you are trying to pop theViewController using

navigationController?.popViewControllerAnimated(false)

UIAlertController的完成块内。因此,您试图从错误的视图中解除, UIAlertController 不是 UINavigationController 堆栈的一部分

inside completion block of UIAlertController. Therefore, you are trying to unwind from the wrong view, UIAlertController is not part of the UINavigationController stack.

首先尝试并关闭 UIAlertController ,然后弹出当前的 ViewController 。换句话说,从完成块中删除 pop 并将其放入确定阻止。或者在警报之前使用展开 segue。

Try and close the UIAlertController first, then pop the current ViewController. In other words, remove the pop from the completion block and put it inside the OK block. or use unwind segue before the alert.

另一种可能性是,你有一个未使用或相同的副本在故事板。因此,如果 unwinding 操作由 storyboard 按钮触发,请选择此按钮并检查连接检查器并删除不需要的连接。

Another possibility, is that you have an unused or identical duplicate in storyboard. Hence, if the unwinding operation is triggered by storyboard button, select this button and check the connectivity inspector and removed unwanted connections.

例如:在我的情况下,标记的红色x是不必要的。

For example: the red x marked was unnecessary in my case.

这篇关于虽然正在进行现有的过渡或演示;导航堆栈不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:59