title: How to programmatically dismiss UIAlertController without any buttons?
body: <p>I'm presenting an UIAlertViewController without any buttons, as it is supposed to just inform users that uploading is in progress. The app is supposed to upload some files to Amazon S3 (some things happen on parallel threads) and I'm afraid that the reference to the alert view controller gets lost when I want to dismiss it.</p>
  
  <p>Any idea on what could be wrong?
  I even don't know how to debug this since there's no error in the Debug area?</p>
  
  <p>I have a class level property: <code>var uploadInProgressAlert = UIAlertController()</code></p>
  
  <p>I use this code to present my alert without buttons (it works):</p>
  
  <pre><code>self.uploadInProgressAlert = UIAlertController(title: "Uploading", message: "Please wait.", preferredStyle: .Alert)
  self.presentViewController(self.uploadInProgressAlert, animated: true, completion: nil)
  </code></pre>
  
  <p>This code is to dismiss the alert (the alert doesn't get dismissed):
  <code>self.uploadInProgressAlert.dismissViewControllerAnimated(false, completion: nil)</code></p>
  
  <p>In this thread: <a href="https://stackoverflow.com/questions/30489828/ios-dismiss-uialertcontroller-in-response-to-event">iOS dismiss UIAlertController in response to event</a> someone talked about "holding the reference". I don't know what it means "hold the reference" and I think this could be the root of the problem.</p>
  
  <p><strong>EDIT:</strong> I've put the above code in a simple test app and there it works. But when things get complicated with some parallel threads I can't find a way to dismiss the alert.</p>
  
  <pre><code>var delay4s = NSTimer()
  var delay8s = NSTimer()
  var alert = UIAlertController()
  
  func showAlert() {
      if NSClassFromString("UIAlertController") != nil {
          alert = UIAlertController(title: "Uploading", message: "Please wait! \n\n", preferredStyle: UIAlertControllerStyle.Alert)
          self.presentViewController(alert, animated: true, completion: nil)
      }
  }
  
  func dismissAlert(){
      self.alert.dismissViewControllerAnimated(true, completion: nil)
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
      delay4s = NSTimer.scheduledTimerWithTimeInterval(4.0, target: self, selector: "showAlert", userInfo: nil, repeats: false)
      delay8s = NSTimer.scheduledTimerWithTimeInterval(8.0, target: self, selector: "dismissAlert", userInfo: nil, repeats: false)
  }
  </code></pre>