title: preferredInterfaceOrientationForPresentation must return a supported interface orientation (iOS 6)
body: <p>My application window's root view controller is a subclassed UINavigationController. I have added this code to the class:</p>
  
  <pre><code>- (BOOL)shouldAutorotate
  {
      return [self.topViewController shouldAutorotate];
  }
  
  - (NSUInteger)supportedInterfaceOrientations
  {
      return [self.topViewController supportedInterfaceOrientations];
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return [self.topViewController preferredInterfaceOrientationForPresentation];
  }
  </code></pre>
  
  <p>In my root UIViewController I have added this code:</p>
  
  <pre><code>- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return UIInterfaceOrientationPortrait;
  }
  
  - (BOOL)shouldAutorotate
  {
      return NO;
  }
  
  - (NSUInteger)supportedInterfaceOrientations
  {
      return UIInterfaceOrientationPortrait;
  }
  </code></pre>
  
  <p>When the device is rotated to landscape on this view controller, I present a modal view controller. When the device is rotated back to portrait, I am supposed to dismiss the modal view, but when I do I get the following error:</p>
  
  <pre><code>'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'
  </code></pre>
  
  <p>Why am I getting this error?</p>
  
  <hr>
  
  <p>I tried returning YES from shouldAutorotate in the root UIViewController, and now I get the error 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'. This makes no sense to my, because UIInterfaceOrientationPortrait is one of the applications supported orientations.</p>