ios - 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"]];
解决方案
根据您的崩溃日志和下面的代码
UIImageView *img = (UIImageView *)[cell.contentView viewWithTag:1];
该变量img
可能是 nil 或其他一些视图。仔细检查您的 imageView 的标签。
如果一切正确,请检查您的单元格 xib(IBOutlet 连接中不应有任何错误或警告),如果您已使用 xib 创建了自定义单元格。
推荐阅读
- sql - 使用 ODBC 从 SQL 连接到 opensge 时收到错误消息
- javascript - 如何删除由 webpack4 创建的重复 JS 包?
- ruby-on-rails - Rails/Nginx/Passenger 错误:Phusion 乘客似乎没有运行
- java - Zuul 代理不路由
- android - 如何在android地图中移动标记
- python - 日期时间格式和添加时间到日期
- python-3.x - LeetCode 69 - 为什么 int(2.0) 等于 1?
- python - 如何使用 keras ReduceLROnPlateau
- python - 之字形水平顺序遍历
- ios - 由于未捕获的异常,iOS 终止应用程序“此类不符合键值编码的键成功。”