我使用AFNetworking 2.0將一些圖像加載到我的應用程序。默認情況下,它緩存它。我不想從緩存中始終加載圖像。我只想在Web圖像和緩存圖像不一樣的情況下從緩存中加載圖像。那我該怎麼做呢?使用AFNetworking 2.0管理緩存圖像
我的代碼:
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];
如何最好的方式知道圖像更新與否? – user3342071