ios - Parse: How can I update all rows with the same key value -
how can update rows same key value in parse class? code, think parse cost lot of money if there 100 objects per user. there other way that?
let username = pfuser.currentuser()?.username let objectquery = pfquery(classname: "friendlist") objectquery.wherekey("username", equalto: username!) objectquery.findobjectsinbackgroundwithblock { (friendlist:[anyobject]?, error:nserror?) -> void in if let friendlist = friendlist as? [pfobject] { myinfo in friendlist { myinfo["contact"] = contact myinfo["portrait"] = pffile(data: portraitnsdata) myinfo["company"] = company myinfo["position"] = position myinfo.save() // create request? } } }
parse has functions object see save many objects (see documentation here)
pfobject.saveallinbackground(array, block: { (succeeded: bool, error: nserror!) -> void in if (error != nil) { println("error saving: \(error)") } })
unfortunately documentation not update swift can see list of function in objective-c
saveall:
saveall:error:
saveallinbackground:
saveallinbackground:block:
Comments
Post a Comment