Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an ambiguous reference when using imagePickerController Delegate function below:

Tags:

ios

swift

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

like image 497
Sathoshi K Avatar asked Dec 03 '25 17:12

Sathoshi K


1 Answers

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

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
like image 141
rmaddy Avatar answered Dec 06 '25 08:12

rmaddy