Long story short, I just updated to Xcode 6 to check how my app works on iOS 8. I noticed that it doesn\'t use the cache even though it should. I\'m using AFNetworking setting t
Both NSURLCache
and NSURLSession
are buggy.
Even if you set NSURLRequestReturnCacheDataElseLoad
for request, iOS may try to reload file from server.
It happens for example when cached response has Vary
header.
Also please notice that method
- (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request
use User-Agent
header from request to distinguish cached objects.
It means iOS will store the same file twice, if you access it by NSURLSession and UIWebView, because User-Agent
is different.