iosobjective-cnsurlconnectionnsurlcache

Clear NSURLConnection cache


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.


Solution

  • You can clear the cache explicitly using:

    obj-c

    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    

    swift

     URLCache.shared.removeAllCachedResponses()