[英]How To Clear Cache Memory When New ViewController Call In IOS 7?
I use NSURLConnection to send request on server NSURLConnection increase cache memory and application crash due to low memory. 我使用NSURLConnection在服务器上发送请求NSURLConnection增加了缓存内存,并且由于内存不足而导致应用程序崩溃。 I use this code for clearing Cache:
我使用以下代码清除缓存:
[[NSURLCache sharedURLCache] removeAllCachedResponses];
But in iOS 7 this code doesn't work any more. 但是在iOS 7中,此代码不再起作用。 Does anyone have any idea how to clear cache memory ?
有谁知道如何清除缓存?
You can create an NSURLCache
with a specific memory or disk usage limitation with -setDiskCapacity:
or -setMemoryCapacity:
. 您可以创建一个
NSURLCache
特定内存或磁盘使用限制与-setDiskCapacity:
或-setMemoryCapacity:
You can clear the cache in UIViewController
's -viewWillDisappear:
or -viewDidDisappear:
. 您可以在
UIViewController
的-viewWillDisappear:
或-viewDidDisappear:
清除缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.