I have a process that consists of three views (and relevant ViewControllers). When the user arrives at the third, they may choose to repeat the step #2. If this happens, i create a new viewcontroller of step 2 with some values and push that using the navigationController. However, i want to amend the viewControllers array so that if user goes back they dont end up in step 3, but rather in step 1.
So i push my viewController and then remove the extraneous ones #3 and #2 from the stack like so:
NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: step2AgainVc.navigationController.viewControllers];
[navigationArray removeObjectAtIndex: navigationArray.count - 3];
[navigationArray removeObjectAtIndex: navigationArray.count - 2];
[step2AgainVc.navigationController setViewControllers:navigationArray animated:NO];
However, this results in the following Console waring:
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Apart from this, everything works as expected. Now this is the first app that i plan to submit to App Store (worked on Enterprise Distributioned ones only before), so i would like to refactor the method to not get the warning. Any suggestions?