开发者

NSURLConnection offline web page with image(s)

开发者 https://www.devze.com 2022-12-17 10:31 出处:网络
I\'m developping an app that download the content of a web page on the iPhone then store it so the user would be able to access it offline.

I'm developping an app that download the content of a web page on the iPhone then store it so the user would be able to access it offline.

I'm using NSURLConnection to download the page, as is the doc. But it downloads only the HTML code without extra content like images.

Even if images are not in a NSData structure, I would开发者_开发百科 like have at least some references or some delegate method call. An idea ?


You have to parse the HTML code and download all referenced files yourself (and then modify the HTML to use relative URLs if it doesn't already). This is not a trivial problem. You might want to look at the source of Unix tools like wget to get an idea of how they do it. I believe libxml2 can parse HTML so that should probably be the library you want to look into.

0

精彩评论

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

关注公众号