尝试从导航堆栈弹出视图时断言失败 [英] Assertion failure while trying to pop views from the navigation stack
本文介绍了尝试从导航堆栈弹出视图时断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试弹出导航堆栈中的特定视图控制器,但是我做错了,因为当我尝试执行代码时弹出此错误
I'm trying to pop to a specific view controller that is in the navigation stack but I am doing something wrong as I am getting this error pop up when I try to execute the code
Assertion failure in -[UINavigationController popToViewController:transition:], /SourceCache/UIKit_Sim/UIKit-1912.3/UINavigationController.m:2229
这是导致问题的代码
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController.xib" bundle:nil];
[self.navigationController popToViewController:firstViewController animated:YES];
推荐答案
设法找到一个其他示例,这些示例都可以很好地工作.
Managed to find an example else where which works perfectly.
///只需选择objectAtIndex号以弹出到导航堆栈上的特定点
//Just choose objectAtIndex number to pop to a particulart point on the navigation stack
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
希望这会有所帮助.
这篇关于尝试从导航堆栈弹出视图时断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文