3
我有一個Parse.com類調用消息,在那裏我有3列:指針字段
- fromUser - Pointer<_User>
- toUser - Pointer<_User>
- image - File
在我的UITableView我試圖找回在消息中的所有對象-class其中toUser等於PFUser currentUser。當我做了查詢,我得到這個錯誤:
UserInfo=0x1702e3580 {code=102, temporary=0, error=pointer field toUser needs a pointer value, originalError=Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)"} {
code = 102;
error = "pointer field toUser needs a pointer value";
originalError = "Error Domain=NSURLErrorDomain Code=-1011 \"The operation couldn\U2019t be completed. (NSURLErrorDomain error -1011.)\"";
temporary = 0;
}
這是我該怎麼辦查詢:
- (void)retriveMessages {
PFQuery *query = [PFQuery queryWithClassName:@"Messages"];
[query whereKey:@"toUser" equalTo:[[PFUser currentUser] objectId]];
[query orderByDescending:@"createdAt"];
query.limit = 1000;
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (error) {
NSLog(@"Error: %@ %@", error, error.userInfo);
} else {
// Found messages!
self.messages = objects;
[self.tableView reloadData];
NSLog(@"%@", objects);
}
}];
}
感謝的人!它工作完美:) – tracifycray
如果我們不尋找一個用戶呢? –
比較指針col時equalTo的第二個參數是PFObject。 PFUser是一個子類。 – danh