如何在 Parse 类中更新具有相同键值的所有行? 作为我的代码,如果每个用户有 100 个对象,我认为 Parse 会花费我很多钱。 还有其他方法吗?
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] {
for myInfo in friendList {
myInfo["contact"] = contact
myInfo["portrait"] = PFFile(data: portraitNSData)
myInfo["company"] = company
myInfo["position"] = position
myInfo.save() // create a request?
}
}
}
最佳答案
形成所需对象的数组,而不仅仅是
PFObject.saveAllInBackground(objectsArray)
关于ios - 解析 : How can I update all rows with the same key value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30834904/