title: Pushing view controller within viewDidAppear doesn't work
body: <h1>Steps to Reproduce</h1>
  
  <p><strong>1)</strong> Create a navigation controller and 3 view controllers.</p>
  
  <p><strong>firstViewController.m:</strong></p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
      NSLog(@"DEBUG: first screen did appear");
      [self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"secondScreen"] animated:NO];
  }
  </code></pre>
  
  <p><strong>secondViewController.m:</strong></p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
      NSLog(@"DEBUG: second screen did appear");
      [self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"thirdScreen"] animated:YES];
  }
  </code></pre>
  
  <p><strong>thirdViewController.m:</strong></p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
      NSLog(@"DEBUG: third screen did appear");
  }
  </code></pre>
  
  <p><strong>2)</strong> make <code>firstViewController</code> (aka firstScreen in storyboard) the root view controller of the navigation controller.</p>
  
  <p><strong>3)</strong> Run app and notice that the navigation bar has updated to show the third screen's title, but still shows the second screen's content.</p>
  
  <h1>Notes</h1>
  
  <p>I've tried using <code>UINavigationControllerDelegate</code>'s <code>-( void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated</code> method since it seems to fire after the <code>viewDidAppear</code> method, but it didn't fix the issue.</p>
  
  <p>I also tried manually setting the navigation controller's <code>viewControllers</code> thinking it would skip some "this view controller is active" logic and allow the problematic push to work, but it didn't.</p>
  
  <h1>Solution</h1>
  
  <p>The only solution I could come up with was using a delayed call to push the desired view controller in <strong>secondViewController.m</strong>:</p>
  
  <pre><code>dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 250 * USEC_PER_SEC), dispatch_get_main_queue(), ^{
      [self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"thirdScreen"] animated:YES];
  });
  </code></pre>
  
  <h1>Problem</h1>
  
  <p>I'd like to understand why this is not working as expected. Based on some other SO answers I've seen on semi-relevant questions, it may have something to do with a run loop, but I can't confirm or deny that (seems possible since dispatching the push allows it to work).</p>
  
  <p>Can anyone else with more knowledge/experience enlighten me?</p>
  
  <p>Thanks!</p>