I have a delegate/handler that i have implemented on my UIViewControllers to handle timeouts to the a remote webservice. When a request is made to my webservice, and a timeout http code is returned, the delegate is called and performs the following:
UINavigationController *navController = self.navigationController;
if (navController) {
[navController popToRootViewControllerAnimated:YES];
} else {
NSLog(@"navController is null/nil");
}
If I do the following steps, navController
is instantiated correctly and the popToRootViewController
action occurs.
Now, if i do the following steps, the else clause in the above code block is triggered because for some reasons navController isn't being set correctly:
My question is: why when i load a ViewController for the second time, does self.navigationController return null?
The call stack in the above example should look like this:
NavigationController -> CustomLoginViewController -> CustomMenuViewController -> CustomSubMenuViewController
Thanks
UPDATE: Still haven't made any progress on this issue!
Hey this might sound really basic but, have you allocated the Navbar object correctly, Maybe you can try setting its property as strong.It maybe so that it is getting deallocated before time.
I think you might have already resolved this but i encountered the exact same thing. And I think we might be doing the exact same thing like using facebook for login. Anyway for some one else in the future this might be useful. The issue that i had that i was re allocating the UINavigationController again when coming back from background on a failure condition.
So what you can do is try to put a breakpoint around the place where you initialise your rootViewController for the UiNavigationController.
[[UINavigationController alloc]
initWithRootViewController:viewController]; and make sure that you do re-initailise your UINavigationController if you have already done it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With