gpt4 book ai didi

ios - 检索自定义用户的个人资料图片

转载 作者:行者123 更新时间:2023-11-28 21:40:18 26 4
gpt4 key购买 nike

我在检索发表评论的用户的个人资料图片时遇到问题。这是我正在使用的代码

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 返回用户的用户名,因为我将其保存在我的帖子类中作为“作者”。

这是我得到的错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString fetchIfNeededInBackgroundWithBlock:]: unrecognized selector sent to instance 0x15f4d670'

上面的查询确实有:[query includeKey:@"user"];

最佳答案

[comment objectForKey:@"author"] 返回的值是 NSString 而不是 PFUser。所以你得到了异常(exception)。

关于ios - 检索自定义用户的个人资料图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32432050/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com