I need to download an entire webPage and store it in app's documents directory and load it from the cache the next time user visits.

No matter how much I search, I always end up with ASIWebPageRequest..!! even though, it works, its very old and deprecated.So I am looking for some alternatives. Another reason I am trying to avoid it is because ....

It is a completely reimplemented URL loading system, based on very low level constructs (CFNetwork). So as Apple makes improvements to their high level libraries (NSURLConnection, NSCache) ASIHTTP doesn't get those advancements.

Hence, I tried this sample code from apple, It gives me a NSData of whichever url i feed it. but, when I try to load this NSData into UIWebView using, loadData:MIMEType:textEncodingName:baseURL: method, I need to specify the mimetype as "text/html" , now the images and links in the webpage doesn't load..!

Is there any other way I can use to achieve it..? perhaps using NSURLCache..? but how?? Is there any other good libraries ou there that i can use or am I stuck with ASIWebPageRequest..?

FYI, I need to download the entire webpage with all js, css etc.

有帮助吗?

解决方案

About an alternative of ASI, AFNetworking is much more popular now. If you want to cache your content, you should have a look at NSURLCacheStoragePolicy and NSURLCache.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top