ios - Can't retrieve a picture to swift from parse.com using their documentation -


i have been trying follow parse.com's intruction retrieve picture uploaded (also using documentation). code:

    let testobject = pfobject(classname: "testobject")     let file = testobject["sampleimage.png"] pffile     file.getdatainbackgroundwithblock {         (imagedata: nsdata?, error: nserror?) -> void in         if error == nil {             if let imagedata = imagedata {                 let image = uiimage(data:imagedata)                 self.mainimg.image = image                 print("image retreived") 

i getting error:

"anyobject! not convertible 'pffile'"

and sugests include ! in 'as'. however, when do, application runs not retrieve anything.

i realize question posted elsewhere, answer not working me. doing wrong?

let testobject = pfobject(classname: "testobject") 

this new empty object isn't backed on server. need set id known value , refresh instance of need run query find object before resulting object contain anything.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -