I'm trying to cache some images loaded from a URL by using AFImageCache, without success... I'm not sure If i'm doing anything wrong and would love your opinions if you've ever used this library.
I'm getting an image from a NSURLRequest, and then caching it as follows
UIImage *img; //This image is a png icon returned from the server
NSData *imgData = UIImagePNGRepresentation(img); // Always checking length to make sure its more than 0, and it is
[[AFImageCache sharedImageCache] cacheImageData: imgData
forURL: myURL
cacheName: @"IconCache"];
On the next run, i'll try to check if the image was cached, but will always get nil
for some reason.
UIImage *myIcon = [[AFImageCache sharedImageCache] cachedImageForURL: myURL cacheName: @"IconCache"];
NSLog("%@", myIcon); // output (null)
Any ideas or thoughts about this? Thanks.