首页 > 解决方案 > SDWebImage 无法识别的选择器

问题描述

在单元格中显示图像时出现以下崩溃。UIImageView sd_setImageWithURL:placeholderImage:completed:]: unrecognized selector sent to instance 0x7fbce1521e70" 我按照提供的所有指令进行操作,但仍然无法得到任何东西,我设置了另一个链接器标志to-Objc`,但仍然得到相同的错误。

单元格我的代码的参考图像:

 UIImageView *img = (UIImageView *)[cell.contentView viewWithTag:1];
    NSLog(@"%@",[NSString stringWithFormat:@"%@thumb_%@",kImageUrl,[dict objectForKey:@"student_photo"]]);


    [img sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@thumb_%@",kImageUrl,[dict objectForKey:@"student_photo"]]]
                      placeholderImage:[UIImage imageNamed:@"not_found.png"]];

标签: iosobjective-csdwebimage

解决方案


根据您的崩溃日志和下面的代码

UIImageView *img = (UIImageView *)[cell.contentView viewWithTag:1];

该变量img可能是 nil 或其他一些视图。仔细检查您的 imageView 的标签。

如果一切正确,请检查您的单元格 xib(IBOutlet 连接中不应有任何错误或警告),如果您已使用 xib 创建了自定义单元格。


推荐阅读