是否可以使用解析从查询更新和保存pfobject?

时间:2014-02-02 03:26:45

标签: parse-platform

是否可以这样做:

PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
[query whereKey:@"playerName" equalTo:@"Dan Stemkoski"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
  if (!error) {

           // THis is the part that isn't working
            PFObject *pTeam = objects[0];
            [pTeam setObject:@"new team name" forKey:@"team"];
            [pTeam saveInBackground];
  } else {
    // Log details of the failure
    NSLog(@"Error: %@ %@", error, [error userInfo]);
  }
}];

当我更新找到的查询对象并保存时,它不会保存到服务器。

我正在做什么,如果是,我做错了什么?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。尝试下面的一个,它对我有用。

        PFObject *pTeam = [PFObject objectWithoutDataWithClassName:"GameScore" objectId: [object[0] objectId]];

        [pTeam setObject:@"new team name" forKey:@"team"];
        [pTeam saveInBackground];