title: Attempt to present * on * whose view is not in the window hierarchy
body: <p>I'm trying to make a modal view controller in my app delegate (I created a function called showLoginView). But whenever I try to call it I get a warning in XCode:</p>
  
  <pre><code>Warning: Attempt to present &lt;PSLoginViewController: 0x1fda2b40&gt; on &lt;PSViewController: 0x1fda0720&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>Here's the method code:</p>
  
  <pre><code>- (void)showLoginView
  {
      PSLoginViewController *loginViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:@"PSLoginViewController"];
      [self.window.rootViewController presentViewController:loginViewController animated:NO completion:nil];
  }
  </code></pre>
  
  <p>How can I add the view to the window hierarchy? Or maybe I'm doing something very wrong?</p>