title: Objective-C: whose view is not in the window hierarchy
body: <p>I have this code that works so that once i press a button the view changes in my storyboard:</p>
  
  <pre><code>UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
  ViewController *viewController = (ViewController *)[storyboard instantiateViewControllerWithIdentifier:@"view1"];
  [self presentViewController:viewController animated:YES completion:nil];
  </code></pre>
  
  <p>This code work but when i use it again to change back to my original view using:</p>
  
  <pre><code>UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
  ViewController *viewController = (ViewController *)[storyboard instantiateViewControllerWithIdentifier:@"view2"];
  [self presentViewController:viewController animated:YES completion:nil];
  </code></pre>
  
  <p>It does not work and i receive this error:</p>
  
  <pre><code>Warning: Attempt to present &lt;UIViewController: 0x863ad30&gt; on &lt;UITabBarController: 0x86309b0&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>The identifies are set and i am not the functions in my <code>viewdidload</code> so i do not know how to fix this.</p>
  
  <p>Can anybody help?</p>