Xcode:单个图像的SDWebImage清除缓存

DeZ*_*gny 15 uiimageview xcode4 sdwebimage

我正在使用SDWebImage来异步映像下载器并支持缓存.

它工作得很好,除了有时图像在服务器上更新了同名,因此我需要从客户端设备缓存中清除它,但没有成功!

我在这里发现我必须使用"removeImageForKey",但Xcode无法识别它!

我正在使用以下代码来设置图像:

[imgPic setImageWithURL:[NSURL URLWithString:@"http://domain.com/image.jpg"] placeholderImage:[UIImage imageNamed:@"tmpPic.png"]];
Run Code Online (Sandbox Code Playgroud)

调用removeImageForKey的正确方法是什么?我需要导入什么而不是UIImageView + WebCache.h?

jti*_*ing 54

- (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk;
Run Code Online (Sandbox Code Playgroud)

API是对的.它对我有用.你知道api是在SDImageCache类中,它是一个单例类.
你可以像这样使用它:

[[SDImageCache sharedImageCache] removeImageForKey:image_url fromDisk:YES];
Run Code Online (Sandbox Code Playgroud)


SEG*_*SEG 21

#import "SDImageCache.h"

....

[[SDImageCache sharedImageCache] removeImageForKey:@"http://domain.com/image.jpg" fromDisk:YES];
Run Code Online (Sandbox Code Playgroud)