【发布时间】:2014-03-24 15:04:49
【问题描述】:
我使用 AFNetworking 2.0 将一些图像加载到我的应用程序中。默认情况下它会缓存它。我不想总是从缓存中加载图像。仅当 Web 图像和缓存的图像不相同时,我才想从缓存中加载图像。那我该怎么做呢?
我的代码:
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Response: %@", responseObject);
_imageView.image = responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Image error: %@", error);
}];
[requestOperation start];
【问题讨论】:
标签: ios iphone caching afnetworking