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 ?

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,083
  • 4
  • 38
  • 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. – Syed Rizwan Jafry Feb 28 '14 at 07:10
  • if i use NSURLCache instead of NSURLConnection then cache memory will stop increasing ??? – Syed Rizwan Jafry Feb 28 '14 at 07:13