我试图清除缓存位,应用程序的大小不会变得明显变小。清除缓存后图像不会从磁盘上删除AFNetworking
我的应用程序大小约为30MB,缓存图像为45MB。
这是我试图清除缓存:
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[AFImageDownloader defaultURLCache] removeAllCachedResponses];
AFAutoPurgingImageCache *imageCache = [AFImageDownloader defaultInstance].imageCache;
[imageCache removeAllImages];
- 在我的iPhone 6 iOS10应用程序的大小并没有变小。
- 模拟器上的应用程序文件内
com.alamofire.imagedownloader/fsCachedData
所有文件仍然存在
这是我如何使用AFNetworking(3.1.0)下载图片:
#import "AFImageDownloader.h"
[photoImageView setImageWithURLRequest:[NSURLRequest requestWithURL:thumb] placeholderImage:myCachedImage success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
[self setPhotoImage:image];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
[self setupPlaceholder];
}];
我发现缓存并不总是在模拟器的工作,尝试真正的设备。 –