10

I'm using a UIImagePickerController with allowsEditing enabled to share images in an App, but found that cropped image is offset for devices running iOS 11 only.

My UIImagePickerControllerDelegate implementation is quite simple, just standard actions:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    let image = info[UIImagePickerControllerEditedImage] as! UIImage

    imageView.image = image
    picker.dismiss(animated: true, completion: nil)
}

Below you can see difference. iOS 10 on the right, iOS 11 on the left. You can see the iOS 11 image is offset down, even though the cropping rectangle was put in exactly the same place.

iOS 10 vs iOS 11 edited image

Here is a video demonstrating the issue: https://www.dropbox.com/s/4csofidjcrc9ah6/UIImagePickerControllerEditedImageOffset.mp4?dl=0

I also created a demo project on GitHub to demonstrate the issue: https://github.com/aivars/photo-Picker-Tests

I would guess that it is UIImagePickerController bug, but wonder why do not find any other error reports online.

I also filed a bug report with Apple: http://www.openradar.me/36292067

mluisbrown
  • 14,448
  • 7
  • 58
  • 86
Aivars
  • 161
  • 9
  • I'm also having the same issue. People may be confusing it with a similar error that existed on iOS 7 (https://stackoverflow.com/q/19397873/368085) but the solution there does not work here as the `UIImagePickerControllerCropRect` is also wrong. – mluisbrown Mar 10 '18 at 13:03
  • Got an answer from Apple engineering team that issue is known and the task is still open. Seems that it is iOS 11 bug. – Aivars Mar 12 '18 at 02:37
  • One thing I have noticed and am investigating now, the offset seems to be much worse for burst, live or pana photos. – Scriptable Mar 26 '18 at 12:53
  • I have tried using my imagePicker in portrait and landscape. The issue only exists in portrait which makes me think this may be a safeAreaInset or statusBar issue that apple has not accounted for. (in order to use imagePicker in landscape you need to set it's modalPresentationStyle to .overCurrentContext) – alionthego Jul 28 '18 at 08:53

0 Answers0