Saving PFObject NSCoding

后端 未结 4 2091
清歌不尽
清歌不尽 2021-02-14 07:45

My Problem: saveInBackground isn\'t working.

The Reason It\'s not working: I\'m saving PFObjects stored in an

4条回答
  •  抹茶落季
    2021-02-14 08:06

    I have created a very simple workaround that requires no change the above NSCoding Libraries:

    PFObject *tempRelationship = [PFObject objectWithoutDataWithClassName:@"relationship" objectId:messageRelationship.objectId];
            [tempRelationship setObject:[NSNumber numberWithBool:YES] forKey:@"read"];
            [tempRelationship saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
                if (succeeded)
                    NSLog(@"Success");
                else
                    NSLog(@"Error");
            }];
    

    What we're doing here is creating a temporary object with the same objectId, and saving it. This is a working solution that does not create a duplicate of the object on the server. Thanks to everyone who has helped out.

提交回复
热议问题