在类中的iOS-Parse更新行

我是Parse的新手。 我正试图学习以下这个链接。 https://www.parse.com/docs/ios_guide#objects-updating/iOS

这是更新的代码不起作用,并创build一个新的。 这是我的代码;

PFObject *testObject = [PFObject objectWithClassName:@"TestObject"]; [testObject setObject:@"oldtestobject" forKey:@"testkey"]; [testObject save]; 

我只想更新oldtestobjectstring。 获得新testing的新价值。

我很抱歉我的英文不好。 我希望我在说什么。

如果你想用parsing来更新一个对象,你首先需要创build一个PFQuery来获取你想要更新的对象,然后修改数据,然后保存新的版本。 以下是示例代码的样子:

 // Create the PFQuery PFQuery *query = [PFQuery queryWithClassName:@"TestObject"]; // Retrieve the object by id [query getObjectInBackgroundWithId:@"oldTestObjectID" block:^(PFObject *pfObject, NSError *error) { // Now let's update it with some new data. In this case, only cheatMode and score // will get sent to the cloud. playerName hasn't changed. [pfObject setObject:@"rowData" forKey:@"columnName"]; [pfObject saveInBackground]; }];