loopidio
loopidio

Reputation: 433

Downloading a File in Swift without caching it

I am using NSURLSession to download a file from a specific url. I have come to the conclusion after several tests that the app itself caches the file, so when I try to download it again the app overrides my instructions and shows me the cached file. Is there a way to say to the program not to cache files? I have searched and haven't found anything... :(

Thank you in advance!

Upvotes: 0

Views: 477

Answers (1)

Cezar
Cezar

Reputation: 56332

When you inititalize the NSURLRequest you'll use with the Download Task, make sure to pass NSURLRequestCachePolicy.ReloadIgnoringLocalCacheDataas the value for the cachePolicy argument.

Upvotes: 2

Related Questions