今日sdwebImage遇到问题

// 设置头像

[_headImageView sd_setImageWithURL:[NSURL URLWithString:_responseModel.ImgUrl] placeholderImage:[UIImage imageNamed:@"toux1"]];

因为图片上传的路径是一样的,加上SDWebImage的缓存影响,所以图片一直是旧的!

修改如下:
[_headImageView sd_setImageWithURL:[NSURL URLWithString:_responseModel.ImgUrl] placeholderImage:[UIImage imageNamed:@"toux1"] options:SDWebImageAllowInvalidSSLCertificates & SDWebImageRefreshCached];
发现问题依旧不能解决

最终解决方案:直接调用缓存来清理图片:
[[SDImageCache sharedImageCache] removeImageForKey:_responseModel.ImgUrl withCompletion:^{
[_headImageView sd_setImageWithURL:[NSURL URLWithString:_responseModel.ImgUrl] placeholderImage:[UIImage imageNamed:@"toux1"] options:SDWebImageAllowInvalidSSLCertificates & SDWebImageRefreshCached];
}];

你可能感兴趣的:(今日sdwebImage遇到问题)