ios - How can I upload images to Parse.com programatically? -


i have large set of images upload, , best way let app me. after copy , pasting code parse's docs, doesn't work.

var image = nsdata(contentsofurl: nsurl(string: "xy1_en_1.jpg")!)! @ibaction func xybutton1(sender: anyobject) {      var = 1; < 147; i++ {          let imagedata = uiimagejpegrepresentation(image) //error on line above: missing argument parameter #2 in call          let imagefile = pffile(name:"image.png", data:imagedata)          var userphoto = pfobject(classname:"cards")         userphoto["imagename"] = "xy1_en_1"         userphoto["imagefile"] = imagefile         userphoto.save()         } } 

what doing wrong?

there 2 problems code. uiimagejpegrepresentation(::) takes 2 parameters, uiimage , float. right calling uiimagejpegrepresentation(_:) , giving nsdata. if want use method nsdata image, need make self.image of uiimage type instead of nsdata. maybe init variable image uiimage(named: "imagename") if image bundled.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -