我在iOS上使用Parse。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"];
我找到了一个办法。
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);
}
}];