Ios 检索自定义用户';s剖面图

Ios 检索自定义用户';s剖面图,ios,parse-platform,pfuser,Ios,Parse Platform,Pfuser,我在为留下评论的用户检索配置文件图像时遇到问题。这是我正在使用的代码 HTKSampleTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"commentReuseID"]; PFObject *comment = [comments objectAtIndex:indexPath.row]; cell.commentLabel.text = [comment objectForKey:@"text"]; N

我在为留下评论的用户检索配置文件图像时遇到问题。这是我正在使用的代码

HTKSampleTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"commentReuseID"];
PFObject *comment = [comments objectAtIndex:indexPath.row];
cell.commentLabel.text = [comment objectForKey:@"text"];

NSDateFormatter* formatter = [NSDateFormatter new];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateStyle:NSDateFormatterShortStyle];
NSString* uploaded = [formatter stringFromDate:comment.createdAt];

cell.timeLabel.text = uploaded;

cell.titleLabel.text = [comment objectForKey:@"author"];


[cell.samImageView loadInBackground];


PFUser *currentUses = [comment objectForKey:@"author"];

[currentUses fetchIfNeededInBackgroundWithBlock:^(PFObject *object, NSError *error) {
   NSString *userphoto = [object objectForKey:@"image"];
    NSLog(@"%@", userphoto);

}];
当我使用NSLog时,currentUses在我将posts类保存为“Author”时返回用户的用户名

这是我得到的错误:

由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFString FetchIfNeedededInBackgroundithBlock:]:无法识别的选择器已发送到实例0x15f4d670'


上面的查询确实有:[query includeKey:@“user”]

由[comment objectForKey:@“author”]返回的值是NSString而不是PFUser。因此,您将遇到异常。

在tableview外部尝试一次,检查是否出现相同的错误代码[comment objectForKey:@“author”]返回的值在设置cell.titleLabel.text=[comment objectForKey:@“author”]时看起来像NSString;稍后您将设置PFUser*currentUses=[comment objectForKey:@“author”],它是NSString而不是PFUser。没错,它是一个字符串。我正在尝试使用字符串的详细信息获取用户。当我使用[PFUser currentuser]时,所有照片都是登录用户的照片,而不是评论人的照片!您可以使用用户名PFQuery*query=[PFUser query]获取PFUser;[查询whereKey:@“用户名”等于:@“实际用户名”];PFUser*user=(PFUser*)[query getFirstObject];成功了!成功了!成功了!非常感谢你!