将 UIWebView 完整内容导出到 NSData?苹果手机 [英] Export UIWebView Full Content to NSData? iPhone
本文介绍了将 UIWebView 完整内容导出到 NSData?苹果手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要做的是在一个小包中获取 UIWebView
的全部内容(文本、图像和 CSS).
我认为 NSData
是最好的方法.或者还有其他更压缩的版本吗?
What I am trying to do is get the UIWebView
s full content (Text, images, and CSS) in one litte package.
I figured NSData
would be the best way to do this. Or is there another more compressed version?
推荐答案
响应这个可能已经晚了,但我发现你可以从你使用 NSCachedURLResponse 发出的请求中获取所有数据:
Probably late enough to respond to this, but I figured out you can get all the data from the request you made with NSCachedURLResponse as such:
NSCachedURLResponse* response = [[NSURLCache sharedURLCache]
cachedResponseForRequest:[webView request]];
NSData* data = [response data];
这篇关于将 UIWebView 完整内容导出到 NSData?苹果手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文