Oh, the delegate method also needs updating. I think because you inadvertently declared it as private, it is confusing the error message system too.
Replace the line:
private func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
with:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
This is the modern API definition which declares the info dictionary with a structured key, rather than simply strings. It is unfortunate that the Apple tutorial was written before this change came in, and clearly hasn't been updated.
(Note, your key can either be .originalImage
or written explicitly as UIImagePickerController.InfoKey.originalImage
. The key does not exist as a member of the top-level UIImagePickerController
type, which is what your first error message was describing).