title: UIPopoverController & UIImagePickerControl: "Popovers cannot be presented from a view which does not have a window"
body: <p>I am trying to display a UIImagePickerControl in my iPad app. At first, the debugger told me that I needed to put it in a popover when doing it on an iPad. So I wrote the following code:</p>
  
  <pre><code>UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
  imagePicker.delegate = self;
  imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
  [popover presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0) 
                           inView:self.view
         permittedArrowDirections:UIPopoverArrowDirectionAny 
                         animated:YES];
  </code></pre>
  
  <p>However, now I get the following error: <code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a view which does not have a window.'</code></p>
  
  <p>Any suggestions on what I should do? I know that self.view <strong>should</strong> have a window, but apparently... it doesn't?</p>