ios - NSURLCache not used by NSURLConnection / AFNetworkingOperation -


when start request nsurlrequestreturncachedataelseload policy expect result nsurlcache if any, no matter how old is. however, system tries reach server request points , returns error if server doesn't answer.

i use uiimageview category of afnetworking request.

nsurlrequest* request = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreturncachedataelseload timeoutinterval:60.0]; __weak __typeof(self) weakself = self; nslog(@"[%@] %@", request.url, [[nsurlcache sharedurlcache] cachedresponseforrequest:request]); // returns instance of nscachedurlresponse! [self setimagewithurlrequest:request placeholderimage:nil success:^(nsurlrequest *request, nshttpurlresponse *response, uiimage *image) {     __typeof(weakself) self = weakself;     self.image = image; } failure:null]; 

this not set image if asking nsurlcache directly return valid nscachedurlresponse.

the app running on ios6 only, there should no problems on-disk cache far know?!

any appreciated! thanks!

this know issue. please refer discussion on afnetworking github page workaround.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -