I am running out of ideas with this problem. I have a UITabbarcontroller and 2 Tabs with Navigationcontrollers in there.
I have a set of ViewControllers for the navigation. These ViewControllers are used in the same order on both tabs/navigationcontrollers with slightly different data.
The previous-to-last Viewcontroller is making a NSURLConnection, and in connectionDidFinishLoading: the last viewcontroller should be shown, using this code:
[self.navigationController popToRootViewControllerAnimated:NO];
[self.navigationController pushViewController:lastViewController animated:YES];
This will pop to the root viewcontroller, but will never push the last ViewController. (Sidenote: This was actually working for quite some time, but stopped working when using this also from the second tabbar's navigationcontroller).
Furthermore, if I comment out the first line:
//[self.navigationController popToRootViewControllerAnimated:NO];
[self.navigationController pushViewController:lastViewController animated:YES];
The last viewcontroller is shown, but misses the back button in the navigation bar, and it's not disabled or something. I suspect that somehow self.navigationcontroller is returning the wrong navigationcontroller. It's as if the navigationcontroller has "forgotten" about the viewcontroller stack.
- Could this be related to connectionDidFinishLoading: being a different thread?
- Has someone a suggestion how to get "the navigationcontroller in this tab" in a different way?
I triple checked the code up and down, I couldn't find anything. The other viewcontrollers before this one are being pushed and popped without any problems.
Thanks for any help on this, I feel stuck!