热门搜索 :
考研考公
您的当前位置:首页正文

SDWebImage 下载图片失败 坑 1

来源:东饰资讯网

使用

- (void)sd_setImageWithURL:(NSURL *)url

或者

- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder 

这个方法下载图片,如果下载第一次 失败了,再使用同样的url 调用该方法,也不会进行第二次尝试, 因为 SD会记录 失败的URL ,对它直接进行错误处理,好在 SD 有提供接口 灵活 处理这样的情况,避免这样的情况 是使用

- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options 

options 传SDWebImageRetryFailed
例如

 [imageView sd_setImageWithURL:url placeholderImage:nil options:SDWebImageRetryFailed];

希望对大家有用,别的问题可以评论留言哦

Top