title: Swift Attempt to present UIAlertController whose view is not in the window hierarchy (presented after TWTRShareEmailViewController)
body: <p>I'm using the Twitter login in the signup process of my app. And I'm asking for the user's email. Once I get it, I'd like to present a UIAlertController. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>func askForTWMail(){
      if (Twitter.sharedInstance().session() != nil) {
          let shareMailVC=TWTRShareEmailViewController(completion: {(mail:String!, error:NSError!) in
              if (mail != nil) {
                  print("GOT MAIL: \(mail)")
                  self.gotMail()
              }else{
                  print("MAIL VC ERROR: \(error)")
              }
          })
          println("PRESENT MAIL VC")
          self.presentViewController(shareMailVC, animated: true, completion: nil)
      }else{
          println("User not logged in")
      }
  }
  
  func gotMail(){
      var alertController=UIAlertController(title: "Some title", message: "Some message", preferredStyle: UIAlertControllerStyle.Alert)
      var okAction=UIAlertAction(title:"Yes", style: UIAlertActionStyle.Default) {
      UIAlertAction in
      //some action
      }
      var cancelAction=UIAlertAction(title:"No", style: UIAlertActionStyle.Cancel){
      UIAlertAction in
      //some action
      }
      alertController.addAction(okAction)
      alertController.addAction(cancelAction)
      self.presentViewController(alertController, animated: true, completion: nil)                
  }
  </code></pre>
  
  <p>But I get this error (I guess because the TWTRShareEmailViewController is not dismissed): </p>
  
  <blockquote>
    <p>Warning: Attempt to present UIALertController on xViewController whose
    view is not in the window hierarchy!</p>
  </blockquote>
  
  <p>Any idea of how I should write this? How can I know when the <code>TWTRShareEmailViewController</code> is dismissed to continue the signup process and be able to present my <code>UIAlertController</code>? I'm not aware of a delegate method related to <code>TWTRShareEmailViewController</code>.</p>
  
  <p>Any help is appreciated. Thanks.</p>