0

I am trying to complete a very simple task. Having a viewController where the user can choose to select an image from the camera och the gallery. I have done pretty much a copy-paste from AppCodas tutorial here.

The problem is that I don't want my users to be able to edit the photo because for some reason the photo gets clipped in a weird way when in landscape mode and I don't want a square picture. So what I am doing is this:

- (IBAction)takePhotoClicked:(id)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self presentViewController:picker animated:YES completion:NULL];
}

- (IBAction)selectPhotoClicked:(id)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentViewController:picker animated:YES completion:NULL];
}

Very simply displaying the UIImagePickerController depending on the users choice, but it doesn't work with picker.allowsEditing = NO; because I get the error message: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates. when I open the imagePicker a second time and I get nilback from the didFinishPickingMediaWithInfo.

Has anyone ever had the same issue?

PaperThick
  • 2,749
  • 4
  • 24
  • 42

1 Answers1

0

Just remove the line "picker.allowsEditing = NO;" & Delete the App from Device & run it..

May be It

nick
  • 114
  • 1
  • 4