I am using AFNetworking version 2.5. I described my problem below. Thanks in advance.
My problem:
When I debug, I see AFNetworking downloads image and stores it to disk. After restart, cache for image remains in disk, however it does not return from NSCache.
Please note that app is also not receiving any memory warning, nor clears cache automatically. Each time I restart, I check files from finder and see they all remain, but AFNetworking can not receive it from cache, and downloads it again.
Below line of "UIImageView+AFNetworking.m" returns nil:
return [self objectForKey:AFImageCacheKeyFromURLRequest(request)];
My Code:
NSURL *imageURL = [NSURL URLWithString:facility.image.list.original];
NSMutableURLRequest *imageURLRequest = [NSMutableURLRequest requestWithURL:imageURL];
[imageURLRequest addValue:@"image/*" forHTTPHeaderField:@"Accept"];
[cell.image setImageWithURLRequest:imageURLRequest placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (request)
{
[UIView transitionWithView:cell.image
duration:0.2f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{[cell.image setImage:image];}
completion:NULL];
}
else
{
[cell.image setImageWithURL:imageURL];
}
} failure:nil];