title: UIBarButtonItem causing unrecognized selector sent to instance
body: <p>I want to create a popover menù on an UIBarButtonItem programmatically, this is the code i write</p>
  
  <pre><code>    static func setNavigationRightButton(myView: UIViewController) {
  
      navBarBtn = UIButton(type: .custom)
      navBarBtn.addTarget(myView, action: #selector(pizza.handleFunc(_:)), for: .touchUpInside)
      navBarBtn.frame = CGRect(x: 0, y: 0, width: 33, height: 30)
      navBarBtn.imageView?.contentMode = .scaleAspectFit
      //navBarBtn.setTitle("10", for: .normal)
      setCartBadge()
      navBarBtn.titleLabel?.font = UIFont.systemFont(ofSize: 9)
  
      let barButton = UIBarButtonItem(customView: navBarBtn)
      myView.navigationItem.rightBarButtonItem = barButton
  }
  </code></pre>
  
  <p>and this is the action func</p>
  
  <pre><code>    func handleFunc(_ sender: UIBarButtonItem!) {
      let vc = storyboard?.instantiateViewController(withIdentifier: "ShoppingCartPopoverVC") as! ShoppingCartPopoverVC
      vc.preferredContentSize = CGSize(width: UIScreen.main.bounds.width, height: 100)
      let navController = UINavigationController(rootViewController: vc)
      navController.modalPresentationStyle = .popover
      let popOver = navController.popoverPresentationController
      popOver?.delegate = self
      popOver?.barButtonItem = sender
      self.present(navController, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>when i'm here "popOver?.barButtonItem = sender" the app crash with this error</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton _viewForPresenting]: unrecognized selector sent to instance 0x7faa0b5148f0'</p>
  </blockquote>