Comments (5)
Your link leads to a 404. Anyway, about your issue, first thing to check is if the URL you are testing is cacheable or not (cache-control header etc.). For instance, http://google.com leads to a 302, which isn't cacheable.
from sdurlcache.
What version of iOS are you running. Versions lower than 4, iOS do not call - (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request.
from sdurlcache.
Ok, it's the headers then. I've changed the URL to another server and it works without problem. Which means I'll have to override the header info somehow because I don't control the remote server. What would be the best place to do this?
Also, the weird thing about the headers is that in these situations the files seem to be getting cached to disk, and iOS seems to be requesting them to later discard them. I tried overridding initWithCoder to force a cache policy of "always" but that didn't work.
I knew about the 3.x iOS since I have an old ipod touch, there the code wasn't being even called.
from sdurlcache.
This is due to the way HTTP caching works : The client may store the response for doing conditional requests even if the response's cache directives don't allow to use the cached data without revalidation. The cache layer (this lib) doesn't control how the request layer (NSURLRequest) handles the cached data.
Because when an UIWebView is used you don't control the cache policy of subsequent NSURLRequests, you can't really force an UIWebView to use the cache even if HTTP server doesn't allow it. One solution though would be to trick NSURLRequest by rewriting the HTTP headers of a cached response before to send it back.
from sdurlcache.
Thanks, I'll look into it.
from sdurlcache.
Related Issues (20)
- XCode 4.3.1 warning HOT 2
- diskCapacity is changing
- ETags support ? HOT 1
- Etags override Cache-Control headers? HOT 1
- SDURLCache and NSURLRequestReturnCacheDataDontLoad HOT 1
- Why not save the expire-date? HOT 1
- UIWebView caching failure for iOS>5.0 HOT 5
- Where is cache in ios5.1.1?
- How to use Application Caches? HOT 3
- SDURLCache differs from the usual cache when used with UIWebView HOT 6
- Are you sure the on-disk cache was removed? HOT 1
- Suggest init diskCacheInfo on mainthread
- AFNetworking's AFImageRequestOperation cannot find cached images sometimes HOT 1
- Static Analyzer Warning - "Null pointer passed as an argument to a 'nonnull' parameter" HOT 1
- Add a new Tag to include ignoreMemoryOnlyStoragePolicy
- SDURLCache.m line 189 issue HOT 2
- Warning
- not work in iOS9 HOT 2
- [SDCachedURLResponse _CFCachedURLResponse]: unrecognized selector sent to instance 0x280081d40'
- ะพ
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdurlcache.