title: presentViewController not working
body: <p>I have this piece of code where I present the alert :</p>
  
  <pre><code>func arraysize() -&gt; [Int]? {
  
      let title = "Your file is empty"
      let message = "Please refer to the instructions"
      let okText = "OK"
  
      let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
      let okayButton = UIAlertAction(title: okText, style: UIAlertActionStyle.Cancel, handler: nil)
      alert.addAction(okayButton)
  
      do{
          ....
  
          if array?.isEmpty == true{
              print("the array is empty")
              presentViewController(alert, animated: true, completion: nil)
          }            
  
      } 
      catch let error {
          print(error)
      }
  
      return array
  }
  </code></pre>
  
  <p>However my alert doesn't show. It used to show and although I haven't changed any code it stopped working for me. Can somebody help me understand what I am doing wrong? </p>
  
  <p>P.S. I am also getting this warning : </p>
  
  <blockquote>
    <p>[16632:713433] Warning: Attempt to present UIAlertController whose view is not in the window hierarchy!</p>
  </blockquote>
  
  <p>Could this be it?</p>