I am trying to update a chat object I have saved with Parse, and although it works sometimes, it's not consistent. If I clear the object out of data on the browser side, it will work a few times, but then I get the error:
Error: object not found for update (Code: 101, Version: 1.3.0)
Here is the code I am using, although I've tried many ways. This code is nearly identical to the Parse documentation.
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];
}];
For good measure, Here is the Parse recommendation:
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];
}];
The Code works sometimes, so I know that's not the issue. I'm just not sure what is.