title: Present view controller asynchronously in background
body: <p>I send an async request and I present a view controller when I receive success. It works.</p>
  
  <p>But I'm getting an issue when my app is in background when I receive success and that I pass it in foreground. The view controller is not always displayed.</p>
  
  <p>I think it's about the main thread but I'm not sure.</p>
  
  <p>How can I fix it ?</p>
  
  <p>EDIT:</p>
  
  <p>Here is the function that I call after the success:</p>
  
  <pre><code>func showPopup(on viewController: UIViewController) {
      let viewControllerToPresent = MyPopupViewController(nibName: "Popup", bundle: nil)
  
      let popup = PopupDialog(viewController: viewControllerToPresent, buttonAlignment: .horizontal, transitionStyle: .zoomIn, gestureDismissal: false)
  
      let button = DefaultButton(title: "Ok") {
          popup.dismiss(animated: true, completion: nil)
      }
  
      popup.addButtons([button])
      viewController.present(popup, animated: true, completion: nil)
  }
  </code></pre>