How do I invalidate iOS's cache for a particular URL?

后端 未结 3 1822
[愿得一人]
[愿得一人] 2021-01-03 00:54

Using NSURLSession\'s default caching, how do I invalidate the cache for a particular URL?

I note NSURLCache\'s removeCachedResponseF

3条回答
  •  粉色の甜心
    2021-01-03 01:32

    Here's what has been working for me:

    request.cachePolicy = NSURLRequestCachePolicy.ReloadIgnoringCacheData
    

    Here are all the options listed regarding chache policy, so you may find one that better suits your need:

    Using Swift 2.2 and Xcode 7.3

提交回复
热议问题