缓存单个网页以供在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。