I'm working with the "Start Developing iOS Apps (Swift) and in the Work with View Controllers I'm having a problem with the "guard let" in the following func.
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
// The info dictionary may contain multiple representations of the image. You want to use the original.
The error I receive is: "Cannot convert value of type 'UIImagePickerController.InfoKey' to expected argument type 'String'".
I think I may have a version issue. Running Xcode 11.5 with this tutorial.
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
// The info dictionary may contain multiple representations of the image. You want to use the original.
Code Block "guard let" selectedImage = info[UIImagePickerControllerOriginalImage] as? UIImage else { fatalError("Expected a dictionary containing an image, but was provided the following: \(info)") } // Set photoImageView to display the selected image. photoImageView.image = selectedImage // Dismiss the picker. dismiss(animated: true, completion: nil)
}The error I receive is: "Cannot convert value of type 'UIImagePickerController.InfoKey' to expected argument type 'String'".
I think I may have a version issue. Running Xcode 11.5 with this tutorial.