我正在尝试更新Parse中已经在类中的对象,但是,虽然没有错误,但是对象没有被更新。 这就是我的代码。
let query = PFQuery(className: "Requests")
query.whereKey("username", equalTo: request.username)
query.findObjectsInBackgroundWithBlock({ (objects, error) -> Void in
if error != nil {
print("Error finding a request")
} else {
if let objects = objects {
for object in objects {
query.getObjectInBackgroundWithId(object.objectId!, block: {(object:PFObject?, error:NSError?) -> Void in
if error != nil {
print("Error getting object a request")
} else if let object = object{
//upadate db
object["response"] = "True"
object.saveInBackground()
}
})
}
}
}
})