缓存单个网页以供在Xcode / UIWEBVIEW中离线使用 [英] Cache a single webpage for use when offline in Xcode / UIWEBVIEW

查看:117
本文介绍了缓存单个网页以供在Xcode / UIWEBVIEW中离线使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIWEBVIEW,它连接到 login.php?email=a@b.com& password = aaa

I have a UIWEBVIEW that connects to a "login.php?email=a@b.com&password=aaa"

登录.php使用这些详细信息来登录到外部网站并使用CURL获取并显示其内容。

Login .php uses these details to login to an external website and fetch and display its contents using CURL.

我有我的login.php来将网页存储到文件夹 / cache / a @ b中.com.html。

I have got my login.php to store the webpage into a folder "/cache/a@b.com.html" on my webserver.

我现在需要找到一种方法来告诉Xcode / UI Webview

I now need to find a way to tell Xcode / UI webview

如果有互联网连接:
-访问login.php
-下载最新的/cache/a@b.com.html并存储在本地。

If there is an internet connection: -Visit login.php -Download latest /cache/a@b.com.html and store local.

如果没有互联网连接:
-加载本地 a@b.com.html文件。

If there isnt an internet connection: -Load local 'a@b.com.html' file.

我希望您理解,

我查看了一些系统,例如: http://robnapier.net/blog/offline-uiwebview-nsurlprotocol-588

I have looked at some systems out there such as: http://robnapier.net/blog/offline-uiwebview-nsurlprotocol-588

但这会存储您的UIWEBVIEW访问的文件在我的情况下是 login.php。

But that stores the file that your UIWEBVIEW visits which in my case is 'login.php'.

谢谢

Jack。

推荐答案

我从未设法通过的RNCachingURLProtocol来完成任务。 https://github.com/rnapier/RNCachingURLProtocol/blob/master/RNCachingURLProtocol.h

这篇关于缓存单个网页以供在Xcode / UIWEBVIEW中离线使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆