我曾考虑过写一个自定义的url缓存,但似乎NSURLCache应该支持磁盘缓存。我想让我的iphone应用程序使用缓存响应,而不打到服务器,直到资源变得陈旧(由我从服务器发回的标头确定)。
我必须使用NSURLConnection打电话吗?
更新:这是一个指向我的代码的链接pastie/808549
解决方案不幸的是,iPhone不能使用NSURLCache进行磁盘缓存,这使得它不适合我概述的场景。
我正在滚动我自己的课程。
I had considered writing a custom url cache, but it seems that NSURLCache is supposed to support a disk cache. I'd like to have my iphone app use cached responses without hitting the server at all until the resource becomes stale (as determined by the headers I send back from the server).
Do I have to call something fancy with NSURLConnection? How can I get the iphone to use the cached version of the url?
Update: Here is a link to my code
pastie/808549
解决方案The answer is, unfortunately, that the iPhone can't do disk caching with NSURLCache, making it inappropriate for the scenario I outlined.
I'm rolling my own class.
更多推荐
我可以强制NSURLConnection从缓存加载吗?
发布评论