6
votes

I'm developing an application where different viewcontrollers are pushed onto a navigation stack when recieving either remote or local notifications.

The problem comes when the application is active and if a notification comes in between an animated viewcontroller transition. This messes up the navigationcontroller and i get the following error message:

nested pop animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

Is there some way to check if viewcontrollers are changing and if so wait until the transition is complete? Or is there perhaps some other methods of solving this problem?

As always, any help is greatly appriciated!

1
Did you find a solution? I have the same problem - I need to present a view controller when a push notification arrives. I can locate the top/visible view controller and present on top of it, but if that view controller happens to be in the state of animating a transition, the app crashes with "Attempting to begin a modal transition from <UINavigationController: 0x1d921c30> to <UINavigationController: 0x1d92c5d0> while a transition is already in progress." None of the UIViewController properties such as isBeingDismissed work since they don't return values unless used from within viewWillAppear - Mark Krenek

1 Answers

4
votes

There are some methods for getting the state of the viewController. Such as: (BOOL)isBeingPresented and (BOOL)isViewLoaded. I would look into the apple doc's on ViewControllers.

Also UINavigationController has a couple of methods also such as:

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated