iphone - 尝试从导航堆栈中弹出 View 时断言失败

标签 iphone ios uinavigationcontroller assertions

我正在尝试弹出到导航堆栈中的特定 View Controller ,但我做错了什么,因为当我尝试执行代码时弹出此错误

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];

最佳答案

设法找到一个完美运行的其他示例。

//只需选择objectAtIndex编号即可弹出到导航堆栈上的特定点

[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];

希望这有帮助。

关于iphone - 尝试从导航堆栈中弹出 View 时断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8829905/

相关文章:

ios - JSON 到 NSDictionary。不应该这么难吗?

iphone - 更改导航 Controller 动画

iphone - viewDidLoad 中错误报告的方向

ios - 查找 CLLocationCoordinate2D 点之间的距离

iphone - 从不工作的 UIButton 创建切换?

ios - 在遗留项目中保留黑色状态栏

ios - Apple Watch HealthKit Manager 更新至 watchOS 4.2.2 后无法工作?

ios - 使用 iOS 7 向后边缘滑动时在哪里实现自动保存代码?

ios - ViewController segue 到 Nav Controller 立即弹出 Nav Controller 并返回到 ViewController

iphone - 从另一个应用程序控制 iPod?