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.
- Authenticate my app with the webservice on a Login ViewController
- Auto trigger a segue to a CustomMenuViewController
- Wait for the webservice to timeout remotely
- Click to trigger a segue to CustomSubMenuViewController
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:
- Authenticate my app with the webservice on a CustomLoginViewController
- Auto segue to a CustomMenuViewController
- Immediately click to trigger a segue to CustomSubMenuViewController
- Click back button to trigger a pop
- Wait for the webservice to timeout remotely
- Click to trigger a segue to the same CustomSubMenuViewController
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!