我遇到了这个我无法弄清楚的错误,它让我头疼。所以,基本上,在我的 iPhone 应用程序中,我有 UITabBar 和一些选项卡,每个选项卡内部都有 UINavigationControllers。

像这样的东西:

    someViewController *someController = [[someViewController alloc] myInit];
    UINavigationController *someNav = [[UINavigationController alloc] initWithRootViewController:someController];
    tab = [[UITabBarController alloc] init];
    tab.viewControllers = [NSArray arrayWithObjects:otherNav, otherNav, evilNav, nil];
    [window addSubview:tab.view];

因此,为了重现我的“珍贵”错误,我会这样做:

click evilNav tab 
-> push tableListView (category list)
-> push otherTableListView (category items list) 
-> push someOtherView (single item)
-> popToRoot || popToController withindex:0 || click on evilNav tab again || pop to otherTableListView -> pop to tableListView
-> crash (with no notable error)

因此,如果我走到 someOtherView 这么远,我就无法返回到第一个 tableListView (rootViewController)而不导致应用程序崩溃。同时,我可以转到其他选项卡,然后甚至单击邪恶导航(当它处于 otherTableListView 或 someOtherView 状态时)而不会崩溃。

什么可能导致这个问题?(如果您需要,我会发布更多代码)

有帮助吗?

解决方案

真的不能告诉出你张贴多一点的代码,但如果我不得不采取一种猜测,我会说你是释放的东西,你不应该再试图访问又是它通常没有错误崩溃。

其他提示

我们需要查看推送和弹出的代码。不过,这似乎是一个内存问题。当第一个视图控制器弹出时,您可能会释放它,即使您还没有完成它。

这可能是由于你的方式宣告私有成员。

我的回答实际上是嵌在我的问题我张贴在这里:的UINavigationController因为

推动和坡平UIViewControllers的崩溃
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top