iPhone - Overwriting existing HTML pages with most recently loaded pages from internet
following is the summary of my requirement
Requirement :
Steps:
NOTE: I already have a page "abc.html" (but it may have outdated contents)
- check for internet connectivity
If the internet connection NOT is ava开发者_StackOverflow社区ilable:
- load the page "abc.html" from resource folder (inside app)
If the internet connection is available:
- get the link to the "abc.html" page (that is on webserver)
- load the existing page "abc.html" from web server
- meanwhile store the new abc.html (on web server) into the app
- notify the user and reload the page
- update the "abc.html" with the HTML page downloaded from Internet
What I have done till now:
- I have checked whether the internet connection is available using Reachability
- 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.
精彩评论