0

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 ?

Rizwan Shah
  • 687
  • 6
  • 18

1 Answers1

0

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:.

bneely
  • 9,063
  • 4
  • 37
  • 46
  • i use [[NSURLCache sharedURLCache] removeAllCachedResponses] code in viewWillDisappear , viewDidDisappear and viewDidLoad but this code not working in IOS7. In IOS7 object release automatically if we use ARC but problem is i use non arc approach. – Rizwan Shah Feb 28 '14 at 07:10
  • if i use NSURLCache instead of NSURLConnection then cache memory will stop increasing ??? – Rizwan Shah Feb 28 '14 at 07:13