UINavigationController 'corrupted navigation bar' issue

I’m having serious problems getting my navigation controller to work and have tried pretty much every related question on this website.

My problem is that when I perform a segue programmatically, there appears to be a transition in the navigation bar, but the view doesn’t change. I see the following errors instead:

  • Simulator slow-motion animations are now on?
  • Can I disable autolayout for a specific subview at runtime?
  • Tag Friends in Facebook Photo Upload
  • UIScrollview getting touch events
  • NSAttributedString and Links on iOS
  • UITableView issue when using separate delegate/dataSource
  • 2013-10-22 13:47:30.059 App[2236:a0b] nested push animation can result in corrupted navigation bar
    2013-10-22 13:47:30.411 App[2236:a0b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
    2013-10-22 13:47:30.501 App[2236:a0b] Unbalanced calls to begin/end appearance transitions for 
    

    My storyboard looks like this:

    enter image description here

    In LoginViewController we perform a segue based on some condition:

    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear];
        NSString* appState = [AppConfig getAppState];
        if ([appState isEqualToString:APP_STATE_WAITING]) {
            [self performSegueWithIdentifier:@"Load" sender:self];
        }
        else if ([appState isEqualToString:APP_STATE_REGISTRATION_AVAILABLE]) {
            [self performSegueWithIdentifier:@"SignUp" sender:self];
        }
    }
    

    In LoadingViewController we wait for a response from a web service before doing:

    - (void)segueToWaitingList:(NSUInteger)behind inFront:(NSUInteger)inFront
    {
        [MosaycOptions setAppState:APP_STATE_WAITING];
        dispatch_async(dispatch_get_main_queue(), ^{
             [self performSegueWithIdentifier:@"Waiting" sender:self];
        });
    }
    

    And it is that segue that gives me the problem. The nav bar transitions but the view does not and we see the following errors printed out:

    2013-10-22 13:47:30.059 App[2236:a0b] nested push animation can result in corrupted navigation bar
    2013-10-22 13:47:30.411 App[2236:a0b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
    2013-10-22 13:47:30.501 App[2236:a0b] Unbalanced calls to begin/end appearance transitions for 
    

    The app doesn’t crash, but no segue occurs, it doesn’t transition to the waiting list view but simply stays on Loading and prints the error to console. When I press back rather than moving back to the login screen I get the following blank screen:

    enter image description here

    If I press back again it crashes with this error: http://pastebin.com/7mCyeQv9

    Something is clearly getting messed up with the navigation stack, however i’ve inspected it using the debugger and it looks absolutely fine, everything gets pushed as normal. I can’t for the life of me figure it out. This is just a standard navigation controller setup that i’ve used before.

    Any ideas?

    2 Solutions Collect From Internet About “UINavigationController 'corrupted navigation bar' issue”

    I finally figured out the problem.

    performSegueWithIdentifier was being called before viewDidAppear was called on the LoadingViewController. A synchronisation error basically.

    You should not perform segue in viewDidLoad.
    Try performing in viewDidApperar:

    Apple documentation:

    Displaying a View Controller’s Contents Programmatically

    Present it from another visible view controller.