Search code examples
iphoneobjective-cuiviewcontrolleruistoryboardsegueoverlay-view

Warning: Attempt to present <AdjustPhotoViewController> on <TakePhotoViewController> while a presentation is in progress


I am using xcode 4.5.2 and created my own OverlayViewController for camera buttons.

Now, when my delegate controller - TakePhotoViewController retrieves the didFinishWithCamera action from OverlayViewController, I would like to transfer the user to AdjustPhotoViewController.

However, I get the following warning and it is not being transferred:

Warning: Attempt to present on while a presentation is in progress!

- (void)didFinishWithCamera
{
    [[self.overlayViewController.imagePickerController presentingViewController] dismissViewControllerAnimated:YES completion:nil];
    [self performSegueWithIdentifier:@"fromTakeToAdjust" sender:self];    
}

Solution

  • The problem was that in TakePhotoViewController, I had :

    - (void)viewDidAppear:(BOOL)animated{
       [self openImagePicker];
    }
    

    This caused to open the image picker, while trying to close it at the same time.

    I added a flag to check it.