Hey everyone and thank you for reading. I am making an app which you can take pictures and retreive pictures from the camera roll and display it on a view. The problem is that when I try to use the button which brings up the camera roll, I get the error "presentation is in progress" as above in the title.
if I comment out the code [self presentViewController:imagePicker animated:YES completion:NULL]; in the viewdidappear method I can bring up the camera roll... I have no idea how to properly dismiss this, I have tried [imagePicker dismissViewControllerAnimated:YES completion:NULL]; but to no avail.
here is my code! Thanks for checking it out.
-(IBAction)chooseExisting:(id)sender {
[imagePicker dismissViewControllerAnimated:YES completion:NULL];
imagePicker2 = [[UIImagePickerController alloc] init];
imagePicker2.delegate = self;
[imagePicker2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:imagePicker2 animated:YES completion:NULL];
}
-(void)viewDidAppear:(BOOL)animated{
while (chooseExistingInt <1) {
overlayView.hidden = false;
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:imagePicker animated:YES completion:NULL];
imagePicker.showsCameraControls = NO;
imagePicker.cameraOverlayView = overlayView;
chooseExistingInt ++;
}
}
FIXED (maybe) I changed:
[imagePicker dismissViewControllerAnimated:YES completion:NULL];
to
[imagePicker dismissViewControllerAnimated:NO completion:NULL];
Changed the animated to "NO". WTF :s