簡體   English   中英

檢索指向PFUser的指針時,iOS解析問題

[英]iOS parse issues when retrieving pointer to PFUser

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

因此它沒有找到每個用戶的屬性。 有人知道解決方案嗎? 謝謝。 我在Follower類中使用的聯接表

在執行查詢之前,嘗試添加此行。

[query includeKey:@"to"];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM