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!
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.