views:

162

answers:

3

Hello,

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)

+1  A: 

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.

Dan Lorenc
+1  A: 

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.

Daniel
Thank you so much! Commenting releases worked like charm and my application no longer crashes. No to figure out what exactly was wrong..Thanks again!
sniurkst
A: 

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

My answer is actually embedded in my question I posted here: http://stackoverflow.com/questions/2807301/uinavigationcontroller-crash-because-of-pushing-and-poping-uiviewcontrollers

Wayne Lo