清除NSURLConnection缓存 [英] Clear NSURLConnection cache

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

问题描述

有没有办法清除NSURLConnection缓存?

Is there a way to clear NSURLConnection cache?

我用它来下载一些字符串,但即使我从服务器上更改了字符串,我仍然会得到相同的字符串。

I used that to download some strings but I keep getting the same strings even though I changed that from my server.

推荐答案

您可以使用以下方式明确清除缓存:

You can clear the cache explicitly using:

obj- c

[[NSURLCache sharedURLCache] removeAllCachedResponses];

swift

 URLCache.shared.removeAllCachedResponses()

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

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