JSA986
JSA986

Reputation: 5936

Picker is not returning any image if allowsEditing=NO

As the title suggests, if I set

imagePickerController.allowsEditing = YES;

to

imagePickerController.allowsEditing = NO

I get no image returned? I have searched SO and can not find a definitive answer

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = NO;
    [self.editController presentModalViewController:imagePicker animated:YES];


- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
  DebugLog(@"info dict: %@", info);
  [picker dismissModalViewControllerAnimated:YES];
  UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
  self.schemeLogo.backgroundColor = [UIColor whiteColor];
  self.schemeLogo.image = image;
  NSData *imageData1 = UIImagePNGRepresentation(image);
  NSString *path1 = [ICUtils pathForDocument:@"schemeLogo.png"];
  [imageData1 writeToFile:path1 atomically:NO];
}

Upvotes: 0

Views: 1031

Answers (1)

JSA986
JSA986

Reputation: 5936

Fixed, needed

[info objectForKey:UIImagePickerControllerOriginalImage];

Upvotes: 6

Related Questions