开发者

iPhone - Overwriting existing HTML pages with most recently loaded pages from internet

开发者 https://www.devze.com 2023-03-18 12:00 出处:网络
following is the summary of my requirement Requirement : Steps: NOTE: I already have a page \"abc.html\" (but it may have outdated contents)

following is the summary of my requirement

Requirement :

Steps:

NOTE: I already have a page "abc.html" (but it may have outdated contents)

  1. check for internet connectivity
  2. If the internet connection NOT is ava开发者_StackOverflow社区ilable:

    1. load the page "abc.html" from resource folder (inside app)

    If the internet connection is available:

    1. get the link to the "abc.html" page (that is on webserver)
    2. load the existing page "abc.html" from web server
    3. meanwhile store the new abc.html (on web server) into the app
    4. notify the user and reload the page
    5. update the "abc.html" with the HTML page downloaded from Internet

What I have done till now:

  1. I have checked whether the internet connection is available using Reachability
  2. Also I am able to show the existing "abc.html" page in UIWebView.

What I am seeking:

I want to know How can I replace (overwrite/ update) this existing "abc.html" page with the one that is just loaded into UIwebView (the one on web-server).

Also If you have a better way to achieve this functionality . please feel free to suggest.

Thank you

EDIT:

I want to use ASIHTTPREquest to achieve this (ASI DataCache)... please guide


There are several ways to do this, but you could take a look at NSURLCache.

If you subclass NSURLCache, you get to control where the web view will load its data from in the cachedResponseForRequest: method. The cache also holds any images the web page might download, so you can provide the full page content, even without a connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号