我有Post
一Comment
堂课。我正在尝试使用指向帖子对象的指针来保存评论。我有我的帖子对象的 ID。这是我的代码:
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...
}
}];
但是,立即保存它会引发异常:*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Found a circular dependency when saving.'
在客户端。
我也试过PFObject *post = [PFObject objectWithoutDataWithObjectId:postId
了,结果'+[PFObject parseClassName]: unrecognized selector sent to class
报错。
Post 不以任何方式依赖评论对象,(即使它依赖于评论对象,它已经是一个保存的对象(因为用户正在评论它)并且指针不应该导致它)为什么我会收到这个错误?