Sathoshi K Sathoshi K - 23 days ago 15x
Swift Question

Getting an ambiguous reference when using imagePickerController Delegate function below:

I trying to have override the imagePickerController function that is in the UIImagePickerControllerDelegate. However, i seem to be getting an error :

Ambiguous reference to member 'subscript'

I have done multiple google searches and this seems to be working fine for everyone else?

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]){

myImageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage

self.dismiss(animated: true, completion: nil)


Any help would be much appreciated. Thank you


You have the wrong signature for the delegate method. It should be:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])