title: Swift - warning: attempt to present on whose view is not in the window hierarchy
body: <p>I got this problem when I click back button inside my SecondViewController.</p>
  
  <pre><code>2014-12-24 12:08:58.838 UPASS[5158:71438] Warning: Attempt to present &lt;APPNAME.ThirdViewController: 0x7ae6bcc0&gt; on &lt;APPNAME.SecondViewController: 0x7af72060&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>code</p>
  
  <pre><code>import UIKit
  
  class SecondViewController: UIViewController {
  
      @IBAction func btnSubmit(sender: AnyObject) {
          let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
  
          let thirdViewController = storyBoard.instantiateViewControllerWithIdentifier("successView") as ThirdViewController
          self.presentViewController(thirdViewController, animated:true, completion:nil)
      }
  
      @IBAction func btnBack(sender: AnyObject) {
          let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
  
          let firstViewController = storyBoard.instantiateViewControllerWithIdentifier("methodView") as FirstViewController
          self.presentViewController(firstViewController, animated:true, completion:nil)
  
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bgCreateUser.jpg")!)
          // Do any additional setup after loading the view.
      }
  
  
  }
  </code></pre>