I have a Post
and a Comment
class. I'm trying to save a comment, with pointer to the post object. I've got my post object's ID. Here is my code:
PFObject *comment = [PFObject objectWithClassName:@"Comment"];
comment[@"content"] = comment;
PFObject *post = [PFObject objectWithoutDataWithClassName:@"Post" objectId:postId];
comment[@"post"] = post;
[comment saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if(succeeded){
//rest...
}
}];
However, saving it immediately raises exception: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Found a circular dependency when saving.'
at the client side.
I've also tried PFObject *post = [PFObject objectWithoutDataWithObjectId:postId
too, which results in '+[PFObject parseClassName]: unrecognized selector sent to class
error.
Post doesn't depend on a comment object in any way, (and even if it did, it's already a saved object (as the user is commenting on it) and a pointer should't cause it) why am I getting this error?