title: dismissing UINavigationController in iOS 5
body: <p>My problem seems to be a bit weird, I have a custom <code>UITarBar</code> which manages several <code>UINavigationController</code>s with a <code>UIViewController</code> that presents those <code>NavController</code>s modally on a <code>UITabBar</code> button <code>touchUpInside</code>, so in iOS 5 my app is crashing because of the <code>dismissModalViewControllerAnimated:</code> method ... And if change the dismiss method to the new one on iOS 5 (<code>dismissViewControllerAnimated:completion:</code>) it does not dismiss the <code>NavController</code>. Here is some code on how I'm changing controllers:</p>
  
  <pre><code>- (void) changeController
  {   
      if ([self.generalViewController respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
          [self.generalViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
      } else {
          [self.generalViewController dismissModalViewControllerAnimated:NO];
      }
      [self.anotherNavController.view addSubview:customTabBar];
  if ([self.generalViewController respondsToSelector:@selector(presentViewController:animated:completion:)]) {
          [self.generalViewController presentViewController:anotherNavController animated:NO completion:nil];
      } else {
          [self.generalViewController presentModalViewController:anotherNavController animated:NO];   
      }
  </code></pre>
  
  <p>Everything is managed in the <code>AppDelegate</code>. Thanks in advice.</p>
  
  <p>EDIT: I found something on this post <a href="https://stackoverflow.com/questions/7821617/dismissmodalviewcontrolleranimated-and-dismissviewcontrolleranimated-crashing">dismissModalViewControllerAnimated: (and dismissViewControllerAnimated) crashing in iOS 5</a> and did what he did (presented the first viewControllerAnimated animated) and then everything like I had before the iOS 5 checks for new presentViewController's selectors and everything works fine on simulator but not on device ..</p>