【发布时间】:2016-11-23 02:06:47
【问题描述】:
我试图清除缓存位,应用程序的大小并没有显着变小。
我的应用程序大小约为 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];
}];
【问题讨论】:
-
我发现缓存并不总是在模拟器中工作,尝试真实设备。
标签: ios afnetworking