title: UISplitViewController: How to present popover?
body: <p>I've a <code>UISplitViewController</code> which is a <code>UISplitViewControllerDelegate</code> with the following delegate method:</p>
  
  <blockquote>
    <p>splitViewController:willHideViewController:withBarButtonItem:forPopoverController:</p>
  </blockquote>
  
  <p>When the iPad is started in Portrait, I would like the Popover from the SplitView to be visible. How can I do that?</p>
  
  <p>I've tried the following code:</p>
  
  <pre><code>- (void)splitViewController:(UISplitViewController *)svc
       willHideViewController:(UIViewController *)aViewController
            withBarButtonItem:(UIBarButtonItem *)barButtonItem
         forPopoverController:(UIPopoverController *)pc
  {
      //setting the barButtonItem in the toolbar in the detail view.
  
      [pc presentPopoverFromBarButtonItem:barButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
  }
  </code></pre>
  
  <p>But the above code gives me the following error:</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'</p>
  </blockquote>