Library for Caching Web Pages on iPhone?

和自甴很熟 提交于 2019-11-27 06:12:34

问题


Is there a library or framework that I can use to cache web pages locally for offline viewing on iPhone? If not, what's the best strategy for doing so?

Currently what I'm thinking of doing is downloading the HTML, harvesting its URLs, caching those URLs, then rewriting the HTML to point to local files. Is that the best way to do it?

Thanks!


回答1:


Take a look at Apple's sample code. Specifically, a program called URLCache

http://developer.apple.com/iphone/library/samplecode/URLCache/index.html

Description

URLCache is a sample iPhone application that demonstrates how to download a resource off the web, store it in the application's data directory, and use the local copy of the resource. URLCache also demonstrates how to implement a couple of caching policies:

  • The local copy of a web resource should remain valid for a period of time (for example, one day) during which the web is not re-checked.

  • The HTTP header's Last-Modified date should be used to determine the last time a web resource changed before re-downloading it.

The audience for this sample is iPhone developers using resources such as images that are retrieved or updated from the web.




回答2:


Best way to cache web pages on iPhone locally for offline access. Check the below URL

http://robnapier.net/blog/offline-uiwebview-nsurlprotocol-588



来源:https://stackoverflow.com/questions/1162295/library-for-caching-web-pages-on-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!