title: UIPopoverPresentationController.barButtonItem not working, seems to be ignored
body: <p>I have an issue while displaying a <code>UIAlertController</code> of type <code>UIActionSheet</code> in iPad. I know iPads need more information in order to display the popover, but I struggle with some strange issues.</p>
  
  <p>I'm checking iOS 13 compatibility issues with my app and it appears the old trick like getting the view with <code>performSelector</code> on a <code>UIBarButtonItem</code> doesn't work anymore.</p>
  
  <h3>Way 1</h3>
  
  <p>So I do this.</p>
  
  <pre><code>if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
      UIView* internalView = (UIView*) [weakSelf.navigationItem.rightBarButtonItem performSelector:@selector(view)];
  
      menuController.popoverPresentationController.sourceView = weakSelf.navigationController.navigationBar;
      menuController.popoverPresentationController.sourceRect = internalView.frame;
      menuController.popoverPresentationController.canOverlapSourceViewRect = YES;
  }
  </code></pre>
  
  <p><code>internalView</code> seems to be nil instead of getting a UIView in older versions of iOS. The popover displays in top left corner of the screen instead of near the navigation bar button item.</p>
  
  <h3>Way 2</h3>
  
  <p>So I try another way to do this, the "proper way" in fact, I guess:</p>
  
  <pre><code>if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
      menuController.popoverPresentationController.barButtonItem = weakSelf.navigationItem.rightBarButtonItem;
  }
  </code></pre>
  
  <p>When I try with this code, the app crashes with the message that explains I have to set sourceView/sourceRect/barButtonItem. But I tell it to do it.</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet from UISmartNavigationController (). The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.  If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'</p>
  </blockquote>
  
  <p>I try with an <code>UIPopoverPresentationControllerDelegate</code> as well but I get same results.</p>
  
  <p>I checked and rechecked, <code>weakSelf.navigationItem.rightBarButtonItem</code> is not nil and set to the right bar button item. I guess I'm missing something huge, but what?</p>