I'm calling UINavigationController
's popToViewController
selector, but it is having no effect. The app doesn't crash or freeze, all of the touch elements on the current viewcontroller stay as is.
See the screenshot below. I'm getting no noticeable errors in execution or console, except for the fact that nothing happens.
Things I have considered:
- Am I on the main thread? Yes, I have ensured this with the
performSelectorOnMainThread
call at the top of my screenshot. - Is
the desired viewcontroller already pushed? Yes, you can see this is
true in the debug panel of the screenshot.
mLoginViewController
is in there. - Before I try to popTo, am I in a presented modal viewcontroller? No, this is happening at a stage when nothing has been presented.
- Are the alerts I call at various places part of the problem? Quite possibly -- maybe they are causing the current viewcontroller to not be done displaying?
Note that at this point in the execution, sometimes the code on lines 263-270 has just been run, which clears the root nav controller's viewControllers array. This means that the currently displayed viewcontroller on the screen is no longer even in the array. Could that be messing up the popTo?
Similar questions:
- poster doesn't understand difference between popToViewController and popViewController: iphone, ipad Navigationcontroller popToViewController not functioning
- poster is just asking how to popTo in general, not running into any problems with it: back to a particular view from any view in ios
- poster is receiving an error message, target viewcontroller may not exist: popToViewController is not working "Tried to pop to a view controller that doesn't exist"
I'm running XCode 5.0 (5A1413), compiling and running on an iPhone 5 with iOS 7.2.