SDWebImage 未更新缓存中的图像

Sus*_*rma 5 objective-c image-caching ios sdwebimage

我正在使用 SDWebImage库来处理图像缓存。我实现了一种从服务器下载图像并在tableView. 这是我下载图像并在tableViewCell In中显示的代码cellForRowAtIndexPath,我执行了以下代码

[cell.profileImageView sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil options:SDWebImageRefreshCached];
Run Code Online (Sandbox Code Playgroud)

它在这里完美地工作。但是当我更新服务器上的图像时,tableViewCell仍然显示相同的图像。问题是,它的缓存没有更新图像。我用相同的关键字进行搜索,并在 StackOverflow 上发现了这个问题。但无法解决问题。我还尝试清除内存和缓存viewDidDisappear

-(void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:YES];
    [[SDImageCache sharedImageCache]clearMemory];
    [[SDImageCache sharedImageCache]clearDisk];
}
Run Code Online (Sandbox Code Playgroud)

但这不是有效的方法。当服务器上的图像更新时,是否有其他方法来更新缓存?

Igo*_*gor 3

您可以使用 SDWebImageRefreshCached 选项来刷新具体图像,但是您永远不知道图像是否在服务器端发生了更改。因此,是否使用图像缓存以及何时更新缓存都取决于您。