ETag and If-None-Match HTTP Headers are not working

前端 未结 2 569
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 02:04

I have a file in my webserver and I am downloading that to my app everytime I access it because its possible that file content might be changed But If it is changed I w

相关标签:
2条回答
  • 2021-02-08 02:14

    I've encountered the same problem. I've discovered that it's because of cachePolicy. You need to set it as follows:

    request.cachePolicy = .ReloadIgnoringLocalAndRemoteCacheData
    

    And you will be OK

    0 讨论(0)
  • 2021-02-08 02:22

    CachePolicy naming convention is confusing and better yet it actually does not implement some of them...

    This article explains them well. http://nshipster.com/nsurlcache/

    Also, if you let the Cache Policy to use UseProtocolCachePolicy then your NSURLSession will receive Status code 200 with response generated from Cache.

    0 讨论(0)
提交回复
热议问题