我有一个Follower类,用于存储我的应用程序的所有关注/关注者关系。但是,当我试图检索每个PFUser的指针时,我无法获得每个PFUser的属性。这是我的代码
PFQuery *query = [PFQuery queryWithClassName:@"Follower"];
[query whereKey:@"from" equalTo:[PFUser currentUser]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
if (!error)
{
for(PFObject *o in objects)
{
PFUser *otherUser = (PFUser *)[o objectForKey:@"to"];
NSLog(@"%@",otherUser);
NSLog(@"%@",otherUser.username);
NSString *nickName = otherUser[@"nickName"];
cell.friendNameLabel.text = nickName;
NSLog(@"%@", otherUser[@"nickName"]);
//cell.friendUsrnameLabel.text = otherUser.username;
PFFile *imgFile = otherUser[@"profilePhoto"];
profileView.file = imgFile;
[profileView loadInBackground];
}
}
else
{
NSLog(@"error");
}
}];
当我尝试打印每个用户时,这是我从控制台获得的内容:
<PFUser: 0x7fc102ec9f70, objectId: GiOIGiNHjK, localId: (null)> {
}
答案 0 :(得分:1)
尝试在执行查询之前添加此行。
[query includeKey:@"to"];