场景:
- 项目中需要使用UIWebView加载一个html网页来显示一段文字。
- 这段文字并不固定,需要变动的时候修改html代码即可,iOS代码并不需要改动。
- 实际操作起来发现,html的代码更改了,但是加载出的webview内容却没变。
出错代码
没有考虑到UIWebView的缓存机制,简单粗暴的加载。

正确代码
设置请求的cachePolicy,忽略缓存。成功

没有考虑到UIWebView的缓存机制,简单粗暴的加载。
设置请求的cachePolicy,忽略缓存。成功
本文标题:UIWebView缓存机制导致的隐患
本文链接:https://www.haomeiwen.com/subject/iwnqcxtx.html
网友评论