0
我试图更新我用Parse保存的聊天对象,虽然它有时会起作用,但并不一致。如果我清除对象了在浏览器端的数据,它会奏效了几次,但后来我得到的错误:解析更新对象错误:找不到更新的对象(代码:101,版本:1.3.0)
Error: object not found for update (Code: 101, Version: 1.3.0)
这里是我使用的代码,虽然我尝试过很多办法。该代码几乎与Parse文档相同。
PFObject *currentChatroom = _currentChatroom;
NSString *objID = currentChatroom.objectId;
PFQuery *query = [PFQuery queryWithClassName:@"Chats"];
// Retrieve the object by id
[query getObjectInBackgroundWithId:objID block:^(PFObject *fetchedChat, 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.
fetchedChat[@"lastTextSent"] = lastTextWithUser;
fetchedChat[@"lastTextSentDate"] = date;
[fetchedChat saveInBackground];
}];
良好的措施,这是解析推荐:
PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
// Retrieve the object by id
[query getObjectInBackgroundWithId:@"xWMyZ4YEGZ" block:^(PFObject *gameScore, 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.
gameScore[@"cheatMode"] = @YES;
gameScore[@"score"] = @1338;
[gameScore saveInBackground];
}];
代码工作有时,所以我知道这不是问题。我只是不确定是什么。
这不是人们想要的授权。 – 2015-02-19 18:13:38