Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AFNetworking's AFImageRequestOperation cannot find cached images sometimes #41

Open
burakkilic opened this issue Sep 14, 2012 · 1 comment

Comments

@burakkilic
Copy link

Hi;

I am using SDURLCache like this:

SDURLCache *urlCache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024 * 20
                                                     diskCapacity:1024*1024*20 
                                                         diskPath:[SDURLCache defaultCachePath]];    
[urlCache setIgnoreMemoryOnlyStoragePolicy:YES];
[NSURLCache setSharedURLCache:urlCache];

And for image request:

NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:c.imagePath] cachePolicy:NSURLRequestReturnCacheDataDontLoad timeoutInterval:30.0];
AFImageRequestOperation *operation = [AFImageRequestOperation imageRequestOperationWithRequest:imageRequest
                                                                                  imageProcessingBlock:nil
                                                                                             cacheName:@"nscache"
                                                                                               success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image){                                                                                                                                                                                                   imageview.image = image;
                                                                                               }
                                                                                               failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){ NSLog([error description]); }
                                              ];
        [operation start];

With these codes, sometimes all of my images are cached and successfully retrieved from the cache. But sometimes, some images cannot be displayed. How can I find the problem?

@tomasikp
Copy link

tomasikp commented Feb 1, 2013

any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants