title: UIIMagePickerController crash on dismissing on iPad ios 6.0
body: <p>I work on iPad 4 with iOS 6.0.</p>
  
  <p>I have a ViewController (MyPickerController) with the following init:</p>
  
  <pre><code>- (id)init
  {
      self = [super init];
      if (self) {
          _picker = [[UIImagePickerController alloc] init];
          _picker.delegate = self;
          _picker.sourceType = UIImagePickerControllerSourceTypeCamera;
          [self.view addSubview:_picker.view];
      }
      return self;
  }
  </code></pre>
  
  <p>I implement the following UIPickerControllerDelegate method to dimiss MyPickerController:</p>
  
  <pre><code>- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
  {
      [self dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>
  
  <p>Well, I have another view controller showed modally in <code>FormSheetStyle</code> and  when I tap on a button I want to show <code>MyPickerController</code> with the following code:</p>
  
  <pre><code>MyPickerController * pickerVC = [[MyPickerController alloc] init];
  [self presentViewController:pickerVC animated:YES completion:nil];
  </code></pre>
  
  <p>In my AppDelegate i Have the following totation method:</p>
  
  <pre><code>- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
      
      return (NSUInteger)[application supportedInterfaceOrientationsForWindow:window] | (1&lt;&lt;UIInterfaceOrientationPortrait);
      
  }
  </code></pre>
  
  <p>When I tap on cancel button of <code>UIIMagePicker</code> into <code>MyPickerController</code>, the application crashes with the following error:</p>
  
  <pre><code>Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!
  </code></pre>
  
  <p>Reading related questions on stackoverflow, I create also the follwing UIImagePickerController category:</p>
  
  <pre><code>@implementation UIImagePickerController (NonRotating)
  
  - (BOOL)shouldAutorotate
  {
      return NO;
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return UIInterfaceOrientationMaskPortrait;
  }
  
  - (NSUInteger)supportedInterfaceOrientations
  {
      return UIInterfaceOrientationMaskPortrait;
  }
  
  @end
  </code></pre>
  
  <p>Thank you!</p>