title: iOS: Warning: Attempt to present <ModalViewController> on <ViewController>while a presentation is in progress
body: <p>I am trying to create a modal view controller after picking an image from the image picker. I use the code :</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
  
     NSLog(@"Picker has returned");
     [self dismissModalViewControllerAnimated:YES];
  
  
  
     // TODO: make this all threaded?
     // crop the image to the bounds provided
     img = [info objectForKey:UIImagePickerControllerOriginalImage];
     NSLog(@"orig image size: %@", [[NSValue valueWithCGSize:img.size] description]);
  
     // save the image, only if it's a newly taken image:
     if([picker sourceType] == UIImagePickerControllerSourceTypeCamera){
        UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
     }
  
     // self.image_View.image=img;
     //self.image_View.contentMode = UIViewContentModeScaleAspectFit;
  
  
     ModalViewController *sampleView = [[ModalViewController alloc] init];
     [self presentModalViewController:sampleView animated:YES];
  }
  </code></pre>
  
  <p>However, I receive the warning:</p>
  
  <pre><code>Warning: Attempt to present &lt;ModalViewController: 0x7561600&gt; on &lt;ViewController: 0x75a72e0&gt; while a presentation is in progress!
  </code></pre>
  
  <p>and the modal view does not appear.</p>
  
  <p>What am I doing wrong?</p>