在检索指向PFUser的指针时,iOS会解析问题

时间:2015-08-10 13:56:10

标签: ios objective-c parse-platform

我有一个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)> {
}

所以它没有找到每个用户的属性。谁知道解决方案?感谢。the join table i used in the Follower class

1 个答案:

答案 0 :(得分:1)

尝试在执行查询之前添加此行。

[query includeKey:@"to"];