【问题标题】:Iphone application crashes when poping to rootController of UITabBar tab大便到 TabBar 选项卡的根控制器时,Iphone 应用程序崩溃
【发布时间】:2009-08-12 14:03:44
【问题描述】:

我遇到了这个我无法弄清楚的错误,这让我很头疼。所以,基本上,在我的 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)。同时我可以转到其他选项卡,然后甚至单击 evilNav(当它处于 otherTableListView 或 someOtherView 状态时)而不会崩溃。

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

【问题讨论】:

    标签: iphone cocoa-touch uikit uitabbar


    【解决方案1】:

    如果你不发布更多代码,我真的无法判断,但如果我不得不猜测,我会说你正在发布一些你不应该发布的东西,然后尝试再次访问它通常会崩溃而没有错误。

    【讨论】:

    • 非常感谢!评论发布就像魅力一样,我的应用程序不再崩溃。不,要弄清楚到底出了什么问题。再次感谢!
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

      这可能是由于您声明私有成员的方式。

      我的答案实际上包含在我在这里发布的问题中:UINavigationController crash because of pushing and poping UIViewControllers

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-17
        • 1970-01-01
        相关资源
        最近更新 更多