弹出到 UITabBar 选项卡的 rootController 时,iPhone 应用程序崩溃

发布于 2024-08-01 20:19:47 字数 1100 浏览 6 评论 0原文

我遇到了这个我无法弄清楚的错误,它让我头疼。 所以,基本上,在我的 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 状态时)而不会崩溃。

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

I'm having this bug I can't figure out and it is making my head hurt. So, basically, in my iphone application I have UITabBar with some tabs each having UINavigationControllers inside.

Something like this:

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

So to reproduce my "precious" bug I go like this:

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)

So if I go so far to someOtherView I can't go back to first tableListView (rootViewController) without application crashing. Meanwhile I can go to other tabs and then even click evilNav (when it is in otherTableListView or someOtherView state) without crashing.

What could be causing this problem? (If you need I will post more code)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我做我的改变 2024-08-08 20:19:47

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

Cant really tell with out you posting a little more code, but if I had to take a guess I would say you are releasing something you should not be then trying to access is it again which usually crashes with no error.

浅忆流年 2024-08-08 20:19:47

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

We need to see the code for the pushing and popping. It seems like it's a memory issue though. You're probably releasing the first viewcontroller when it's popped, even though you're not done with it yet.

流年里的时光 2024-08-08 20:19:47

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

我的答案实际上嵌入在我在这里发布的问题中:UINavigationController crash due to推送和弹出 UIViewControllers

It could be due to the way you declare private members.

My answer is actually embedded in my question I posted here: UINavigationController crash because of pushing and poping UIViewControllers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文