【发布时间】:2015-02-27 22:20:08
【问题描述】:
我正在尝试在解析中更新我的用户类中的特定用户“totalScore”列。 “totalScore”是一个字符串值。我在didSelectRowAtIndexPath: 中运行下面的代码。我从我想在我的表格视图中显示的查询用户列表中获得self.friends。当我运行此代码并记录它时,它似乎工作正常,但该对象从未在我的数据浏览器中更新。另外:我可以在线更新这个对象,而不是在应用程序中!谢谢!
PFUser *user = [self.friends objectAtIndex:indexPath.row];
PFQuery *query = [PFQuery queryWithClassName:@"_User"];
[query whereKey:@"objectId" equalTo:user.objectId];
[query getFirstObjectInBackgroundWithBlock:^(PFObject * userStats, NSError *error) {
if (!error) {
[userStats setObject:@"#5" forKey:@"totalScore"];
[userStats saveInBackground];
} else {
// Did not find any UserStats for the current user
NSLog(@"Error: %@", error);
}
}];
【问题讨论】:
标签: ios objective-c object parse-platform