Swift 带有tableview的popToRootViewController发生崩溃

Swift 带有tableview的popToRootViewController发生崩溃,swift,uinavigationcontroller,uitabbarcontroller,Swift,Uinavigationcontroller,Uitabbarcontroller,我有一个带有5个navigationController的选项卡栏。我在myViewController中还有一个tableView。当我尝试在第一个navigationController的视图中使用self.poptrootviewcontroller时,它将消失,并崩溃。我还在3 navigationController中推送相同的myViewController,并在ViewWillEnglish中使用相同的self.poptrootViewController函数。它工作得很好。我尝试

我有一个带有5个navigationController的选项卡栏。我在myViewController中还有一个tableView。当我尝试在第一个navigationController的视图中使用self.poptrootviewcontroller时,它将消失,并崩溃。我还在3 navigationController中推送相同的myViewController,并在ViewWillEnglish中使用相同的self.poptrootViewController函数。它工作得很好。我尝试为调试设置动画true和false。这两者都会导致崩溃。让第一个导航控制器popToRootViewController功能工作的唯一方法是将iOS升级到13。(iOS 12.4会发生崩溃。)

有人知道为什么导航不能弹出带有tableView的控制器吗?消息说未设置UItableView数据源。这很奇怪,因为我可以很好地推送myViewController,我认为pop意味着删除堆栈中的元素

另一方面,popToRootViewController函数可以在以下函数中很好地工作

func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {

     firstNavigationController.popToRootViewController(animated: true)

}

/// Show and hide the tab bar.
///
/// - Parameters:
///   - hidden: To hide or show.
///   - animated: To animate or not.
///   - duration: The duration of the animation.
///   - completion: The completion handler that is called once the animation is completed.
open func setBar(hidden: Bool, animated: Bool,duration: TimeInterval = 0.3, completion: ((Bool)->Void)? = nil) {
    let animations = {() -> Void in
        let safeAreaBottom: CGFloat

        if #available(iOS 11.0, *){
            safeAreaBottom = self.view.safeAreaInsets.bottom
        }else{
            safeAreaBottom = 0.0
        }

        self.buttonsContainerHeightConstraint.constant = hidden ? 0.0 : self.buttonsContainerHeightConstraintInitialConstant + safeAreaBottom
        self.view.layoutIfNeeded()
    }
    if animated {
        self.view.layoutIfNeeded()
        UIView.animate(withDuration: duration, animations: animations, completion: completion)
    }
    else {
        animations()
    }
}
日志 libc++abi.dylib:以NSException类型的未捕获异常终止

截图


如有任何建议,我们将不胜感激。谢谢。

加入日志崩溃调用堆栈显示
AZTabBarController.showBar(…)
-您可以将此方法(作为代码,而不是屏幕截图)添加到问题中吗?@andreasetjen我使用AZtabbar来控制我的选项卡栏。嗨@AndreasOetjen你的评论真的很完美。我再次检查代码并更改代码self.currentTabBar?.setBar(隐藏:true,动画:false)。在我关闭动画之后。它不再崩溃了,谢谢你。