开发者

How to Save Web Pages and Blogs for Offline Reading in iPhone

开发者 https://www.devze.com 2023-04-13 03:19 出处:网络
I need to save the contents of blogs loaded on the webview for offline reading. Does webview support caching and if it does, how much is the size it can cache? Currently I am loading the webview as fo

I need to save the contents of blogs loaded on the webview for offline reading. Does webview support caching and if it does, how much is the size it can cache? Currently I am loading the webview as follows:

NSURL *url = [NSURL URLWithString:_entry.articleUrl];    
_webView.delegate =self;
[_webView loadRequest:[NSUR开发者_如何学编程LRequest requestWithURL:url]];

I get the resposnse in

- (void)webViewDidFinishLoad:(UIWebView *)webView

but could not find anywhere in UIWebView's documentation where I can find the data loaded in that webView. Any help will be greatly appreciated.


    NSData *cacheUrlData = [NSData dataWithContentsOfURL:url];

Save this NSData anywhere you want. Preferably in dictionary with the key=url and value= cacheUrlData and write this dictionary to a plist file in Documents Directory..

0

精彩评论

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