iOS: Avertissement: Essayez de présenter & lt; ModalViewController & gt; sur & lt; ViewController & gt; pendant qu'une présentation est en cours

Je suis en train de créer un modal-vue-contrôleur, après la sélection d'une image à partir de l'image de sélecteur. J'utilise le 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];
}

Cependant, je reçois l'alerte:

Warning: Attempt to present <ModalViewController: 0x7561600> on <ViewController: 0x75a72e0> while a presentation is in progress!

et modale de vue n'apparaît pas.

Ce que je fais mal?

source d'informationauteur alandalusi