title: Dismissing and presenting modalviewcontrollers
body: <p>Goodday,</p>
  
  <p>I got an application where an user logs in, and when the log in details is correct, the modalviewcontroller is dismissed. After the viewcontroller is dismissed, another view controller is called upon. This all goes fine except for the fact, when i want to switch back to my original controller: My login controller. I got the following code:</p>
  
  <p>This code is called when the user logs in:</p>
  
  <pre><code>[self dismissModalViewControllerAnimated:YES];
  Form *formcontroller1 = [[Form1 alloc] init];
  [self presentModalViewViewController:formcontroller1 animated:YES];
  </code></pre>
  
  <p>After the user logged in, there is a logout button wich calls the following code:</p>
  
  <pre><code>[self dismissModalViewControllerAnimated:YES];
  Postform3ViewController *logincontroller = [[Postform3ViewController alloc] init];
  [self presentModalViewViewController:logincontroller animated:YES];
  </code></pre>
  
  <p>After the button is clicked, i get the following error message:</p>
  
  <blockquote>
    <p>Postform3[5848:207] <em>*</em> Terminating app due to uncaught exception
    'NSInternalInconsistencyException', reason: 'Attempting to begin a
    modal transition from  to  while a transition is already in progress. Wait for
    viewDidAppear/viewDidDisappear to know the current transition has
    completed'</p>
  </blockquote>
  
  <p>And i wonder if anyone can help me with this problem..</p>