Issue with UIWebView caching pages

匆匆过客 提交于 2019-12-11 20:18:10

问题


I'm loading a remote html page into a UIWebView, the page is held on my mac book pro using and made available via OS X's built in Apache server.

I've noticed that if I load the page in the UIWebView, then make changes to the page and reload it then the changes are not reflected, hence it must presumably be being cached somewhere. I get this behavior even if I quit the app containing the UIWebView and re-launch it.

Where is the web page being cached? Is it possible to force the UIWebView to get the latest updated page?


回答1:


Try this -

[[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest];

This would remove a cached response for a specific request. There is also a call that will remove all cached responses for all requests ran on the UIWebView:

[[NSURLCache sharedURLCache] removeAllCachedResponses];



来源:https://stackoverflow.com/questions/12712785/issue-with-uiwebview-caching-pages

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