I use NSURLConnection to send request on server NSURLConnection increase cache memory and application crash due to low memory. I use this code for clearing Cache:
[[NSURLCache sharedURLCache] removeAllCachedResponses];
But in iOS 7 this code doesn't work any more. 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:
. You can clear the cache in UIViewController
's -viewWillDisappear:
or -viewDidDisappear:
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.