title: Xamarin.iOS UIPopoverPresentationController Exception
body: <p>I am having difficulty presenting a Popover with <code>UIPopoverPresentationController</code>, following what can I find from the internet, including <a href="https://developer.apple.com/documentation/uikit/windows_and_screens/displaying_transient_content_in_a_popover" rel="nofollow noreferrer">this</a> and <a href="https://stackoverflow.com/questions/28548760/ios-8-ipad-app-crashes-when-uiactivityviewcontroller-is-called">this</a>. Nothing has helped. Here's a test app I created:</p>
  
  <p><strong>ViewController.cs</strong></p>
  
  <pre><code>  public override void ViewDidLoad()
    {
       ...
  
       var popupView = new UIImageView(new CGRect(0, 0, 200, 200))
       {
          Image = UIImage.FromBundle("Menu")
       };
  
       _menuController = new UIViewController
       {
          ModalPresentationStyle = UIModalPresentationStyle.Popover,
          View = popupView
       };
  
       _presentationController = new UIPopoverPresentationController(_menuController, this)
       {
          SourceView = View,
          SourceRect = new CGRect(50, 50, 300, 300),
       };
    }
  </code></pre>
  
  <p>And I invoke on button press with:</p>
  
  <pre><code>  PresentViewController(_menuController, true, null);
  </code></pre>
  
  <p>I get this exception when the presentation style is <code>Popover</code>:</p>
  
  <blockquote>
    <p>UIPopoverPresentationController should have a non-nil sourceView or
    barButtonItem set before the presentation occurs.</p>
  </blockquote>