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
Post a Comment