离线缓存之RNCachingURLProtocol解析

时间:2014-05-04 20:32:05   收藏:0   阅读:1699

主要功能:实现 网页离线加载。基本思想来源于AFCache。作者是Rob Napier(IOSX Programming的作者)。

使用方法:

  1. To build, you will need the Reachability code from Apple (included). That requires that you link with SystemConfiguration.framework.

  2. At some point early in the program (usually application:didFinishLaunchingWithOptions:), call the following:

    [NSURLProtocol registerClass:[RNCachingURLProtocol class]];

更多详情,参考http://robnapier.net/offline-uiwebview-nsurlprotocol/简介:将每次的HTTP请求缓存至disk。提交HTTP请求之前,会检查本地是否有缓存。

不主动清除缓存。不适用有太多HTTP请求的环境。

解析:

其他相关:

Mugunth Kumar写了一个基于REST连接的离线缓存工具MKNetworkKit。

详情见下一篇。

离线缓存之RNCachingURLProtocol解析,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!