关于SDWebImage加载图片使用SDWebImageRefreshCached无效

今天做用户头像上传,发现使用SDWebImage的SDWebImageRefreshCached重新加载之后无效了,以前的还是可以的,查阅资料找到了解决办法:

// 在 SDWebImageManager.m 文件中有这样一段代码
if (cachedImage && options & SDWebImageRefreshCached) {
       // force progressive off if image already cached but forced refreshing
       downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload;
        // ignore image read from NSURLCache if image if cached but force refreshing
        downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;
 }

// 修改为如下:(仅在中间加上一行代码)
if (cachedImage && options & SDWebImageRefreshCached) {
      // force progressive off if image already cached but forced refreshing
      downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload;
                

      // remove SDWebImageDownloaderUseNSURLCache flag
      downloaderOptions &= ~SDWebImageDownloaderUseNSURLCache;
                
                
      // ignore image read from NSURLCache if image if cached but force refreshing
      downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;
}

感谢网友提供的方法;
参考一
参考二

你可能感兴趣的:(关于SDWebImage加载图片使用SDWebImageRefreshCached无效)