问题描述:

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)

网友答案:

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.

网友答案:

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.

网友答案:

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

相关阅读:
Top