Sathoshi K Sathoshi K - 1 year ago 221
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

Answer Source

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

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download