title: Warning: Attempt to present on whose view is not in the window hierarchy! in UISearchController
body: <p>I have an error with <code>UITableViewController</code> and "UISearchController". I did by different. I wrote <code>self.definesPresentationContext = true</code> into viewDidLoad, but I got the same error. </p>
  
  <p>Warning: Attempt to present  on  whose view is not in the window hierarchy!</p>
  
  <p>Please help.</p>
  
  <p>My viewDidLoad code</p>
  
  <pre><code>    override func viewDidLoad() {
      super.viewDidLoad()
  
      self.navigationItem.leftBarButtonItem = self.editButtonItem()
  
      fetchedResultsController = NSFetchedResultsController(fetchRequest: allEmployeesFetchRequest(), managedObjectContext: managedObjectContext!, sectionNameKeyPath: "mynote", cacheName: "mynote") // both mynote
      fetchedResultsController?.delegate = self
      fetchedResultsController?.performFetch(nil)
  
      self.searchController = ({
          var controllerS = UISearchController(searchResultsController: nil)
          controllerS.delegate = self
          controllerS.searchBar.delegate = self
          controllerS.searchResultsUpdater = self
          controllerS.searchBar.sizeToFit()
          controllerS.dimsBackgroundDuringPresentation = false
          controllerS.hidesNavigationBarDuringPresentation = false
       //   self.definesPresentationContext = true
          self.tableView.tableHeaderView = controllerS.searchBar
          return controllerS
      })()
  }
  </code></pre>
  
  <p>My prepareForSegue code </p>
  
  <pre><code>  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
      if segue.identifier == "showDetail" {
          if let indexPath = self.tableView.indexPathForSelectedRow() {
              if searchPredicate == nil {
              let object = self.fetchedResultsController!.objectAtIndexPath(indexPath) as! NSManagedObject
              let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController //DetailViewController
                  controller.detailItem = object
              } else {
                  let object = filteredObjects![indexPath.row] as Note
                  let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
                  controller.detailItem = object
              }
          }
          self.searchController.active = false
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong>
  If I made <code>self.definesPresentationContext = true</code> then I need to touch two once on back button that be return on <code>UITableViewController</code> from <code>SecondViewController</code></p>