UIWebView 缓存页面的问题 [英] Issue with UIWebView caching pages

查看:25
本文介绍了UIWebView 缓存页面的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个远程 html 页面加载到 UIWebView 中,该页面使用我的 mac book pro 保存并通过 OS X 的内置 Apache 服务器提供.

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.

我注意到,如果我在 UIWebView 中加载页面,然后对页面进行更改并重新加载,则更改不会反映出来,因此它可能被缓存在某处.即使我退出包含 UIWebView 的应用程序并重新启动它,我也会得到这种行为.

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.

网页缓存在哪里?是否可以强制 UIWebView 获取最新更新的页面?

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

推荐答案

试试这个 -

[[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest];

这将删除特定请求的缓存响应.还有一个调用将删除在 UIWebView 上运行的所有请求的所有缓存响应:

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];

这篇关于UIWebView 缓存页面的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆