Пытаюсь передать картинку из галереи в новый ViewController
, но возникает ошибка
Creating an image format with an unknown type is an error fatal error: unexpectedly found nil while unwrapping an Optional value
Код:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let im = info[UIImagePickerControllerOriginalImage] as? UIImage {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "editImage") as! EditImageViewController
vc.imageView.image = im
self.present(vc, animated: true, completion: nil)
} else {
print("Something went wrong")
}
imagePicker.dismiss(animated: true, completion: nil)
}
В чем ошибка?