What is the result if I didn't edit the picture?
(image = nil ? or image = OriginalImage)
picker.allowsImageEditing = YES;
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWith开发者_运维百科Info:(NSDictionary *)info
{
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
}
Either the key would not exist in the dictionary or it would be the same as the original image. The easiest thing to do is just to code defensively:
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
if (!image) image = [info objectForKey:UIImagePickerControllerOriginalImage];
That way you'll still get sane results even if the behavior is different on different versions of iOS.
精彩评论