我有一个使用故事板的应用程序。布局是:导航控制器 > 登录视图控制器 > 选项卡栏控制器,每个选项卡都有一个导航控制器,指向该选项卡的 UIViewController。我正在尝试创建一个注销按钮,该按钮将删除 TabBarController 并返回到登录视图控制器。我的代码如下:
// In log out function
[self.tabBarController dismissViewControllerAnimated:YES completion:nil];
[self performSelector:@selector(patchSelector) withObject:nil afterDelay:0.3];
-(void)patchSelector{
[self.tabBarController.navigationController popToRootViewControllerAnimated:YES];
}
我不断收到以下错误:
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'presentedViewController for controller is itself on dismiss for
我尝试阅读以下内容:
没有可见的dismissModalViewControllerAnimated界面:完成
http://www.touchthatfruit.com/viewwillappear-and-viewdidappear-not-being-ca
UITabbarController 关闭模式 UINavigationController
但是,以上都没有帮助解决我遇到的错误。我在这有什么遗漏吗?该错误似乎表明当前的 vc 正在清理中。