Reputation: 3829
I'm trying to find a way to get a UIWebView to cache an entire web page while one wifi and view it from the cache while connected to 3G, but then reload and recache while on WiFi again.
Are the any APIs or anything to do this?
Cheers
Upvotes: 3
Views: 3041
Reputation: 12671
regardless of 3G or WIFI you can use NSURLRequestReturnCacheDataElseLoad
with your NSURLRequest
which caches webpage otherwise load.. you could create a check for your 3G status
here is the usage of NSURLRequestReturnCacheDataElseLoad
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval: 10.0];
and load your data returned from webpage by using loadHTMLString
in UIWebView
Upvotes: 3