开发者

URL Cache iphone

I have a开发者_Go百科 webView and I use [NSURLRequest requestWithURL:] to load the page. But since this increases the dependency on the network I am trying to cache the page such that the webView loads only once in a day. I tried using NSURLequest requestWithURL: cachePolicy: timeoutInterval: but this did not work. The example provided by apple "URLCache" is for images. How can i reduce the dependency on the network?

Thanks, Praveen


You could store the HTML from your request either in sqlite locally or on the file system for the initial daily request. Subsequent requests and just pull the HTML from the local store.

This is the delegate that gets the HTML (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜