Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use cache policy NSURLRequestReloadRevalidatingCacheData

The links below

iOS - Download file only if modified (NSURL & NSData)

http://nshipster.com/nsurlcache/

mentions that NSURLRequestReloadRevalidatingCacheData is not yet implemented in iOS 7.

Is this implemented in iOS 12? If it is, can you tell me how to use it?

If not, what are the alternatives / best practices for validating cache against server before using?

Thanks!

like image 406
Ted Avatar asked Sep 27 '22 23:09

Ted


1 Answers

NSURLRequestReloadRevalidatingCacheData (ReloadRevalidatingCacheData in Swift) is still not implemented in iOS9.

You can implement this behaviour manually by sending a HEAD network request and checking last modification date. Here's how to do it: iOS - Download file only if modified (NSURL & NSData)

like image 91
wyszo Avatar answered Oct 05 '22 08:10

wyszo