UIWebView加载本地文件时的重复

带颜值的程序员 2016-11-30 06:04:43
项目中用到了本地的HTML,当webView去加载的时候去替换里面的网址,但是当我退出后重新加载另一个网页时,webview显示的是上一个网页,这是什么情况啊?很郁闷但是当我杀掉程序后就正常了,清除缓存也写了。。。
#pragma mark 清除webview的缓存----
- (void)deleteCache{
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSURLCache *cache = [NSURLCache sharedURLCache];
[cache removeAllCachedResponses];
[cache setDiskCapacity:0];
[cache setMemoryCapacity:0];
}
...全文
256 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧