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