iPhone: Performances Differences Between NSURLRequestCachePolicy Settings

ぐ巨炮叔叔 提交于 2019-12-03 12:27:25

I don't think this will make any difference on your UIWebView loading times. UIWebView is built on WebKit, and they're not using NSURLConnection internally (they are at a much lower level and use CFNetwork directly).

This is probably not what you want to hear, but probably the best way to speed up UIWebView loading time is to not use a UIWebView. Rendering web pages is pretty CPU-intensive. In fact, MobileSafari is actually mostly CPU-bound, not network-bound -- notice how long it takes it to fill in that checkerboard pattern when scrolling, for example. For really fast, quickly loading content, it's best to create a native interface in Cocoa.

I a few hours for a project trying to get a UIWebView to cache pages I was loading. It proved impossible from the application side without storing the files locally. It seems that UIWebView ignores the NSURLRequestCachePolicy completely.

Yahoo! has some info on the iPhone's caching behaviour.

I just did a grep on the WebKit sources, and didn't find any use of the -[NSURLRequest cachePolicy].

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!