UIImagePickerControllerOriginalImage is not working in ios 11.2.1

Nikhil Manapure picture Nikhil Manapure · Dec 26, 2017 · Viewed 10.3k times · Source

In what cases will I be sad? if I have set allowEditing as false.

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    if let selectedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
        // I am happy :)
    } else {
        // I am sad :(
    }
    dismiss(animated: true, completion: nil)
}

(I got a crash in iOS 11.2.1 iPhone SE(as per Crashlytics), so confused if there are legit conditions where this can fail or it is just an iOS bug.)

Answer

José Raúl Toledano R picture José Raúl Toledano R · Apr 11, 2019

changed in IOS 12

  image.image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage