swift - Contextual type 'AnyObject' cannot be used with array literal -
i'm trying upgrade upgrade project swift 2 stuck on following error:
contextual type 'anyobject' cannot used array literal
here's code:
func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingimage image: uiimage!, editinginfo: [nsobject : anyobject]!) { let data = uiimagejpegrepresentation(image, 0.08) let file = pffile(data: data!) pfuser.currentuser()!["picture"] = [file] try! pfuser.currentuser()!.save()} and here’s line problem occur
pfuser.currentuser()!["picture"] = [file] thanks lot !! (i'm beginner,...)
substitute line:
pfuser.currentuser()!["picture"] = [file] with:
pfuser.currentuser()!["picture"] = file edit: noted, better practice not force unwrap conditional , follows:
guard let user = pfuser.currentuser() else { return } user["picture"] = file
Comments
Post a Comment