我正在使用Parse for iOS。 https://www.parse.com/docs/downloads/ 但是,我在更新指定objectID的bool值时遇到了困难,如图所示。
http://tinypic.com/view.php?pic=8y4zt2&s=5
我可以通过这样的设置添加新行。但是,现在,我想更新指定objectID的bool值。我想知道怎么做。
PFObject *gameScore = [PFObject objectWithClassName:@"GameScore"];
[gameScore setObject:[NSNumber numberWithBool:NO] forKey:@"cheatMode"];
答案 0 :(得分:7)
我找到了办法。
PFQuery *query = [PFQuery queryWithClassName:@"test"];
[query whereKey:@"objectId" equalTo:objectIDForReport];
[query getFirstObjectInBackgroundWithBlock:^(PFObject * reportStatus, NSError *error) {
if (!error) {
// Found UserStats
[reportStatus setObject:[NSNumber numberWithBool:YES] forKey:@"report"];
// Save
[reportStatus saveInBackground];
} else {
// Did not find any UserStats for the current user
NSLog(@"Error: %@", error);
}
}];