NSURLSession ignoring NSURLSessionConfiguration Cache Policy

917 views Asked by At

Even after setting the Cache Policy, my NSURLSession is still loading cached data:

let url = NSURL(string: urlString);
var sessionConfig = NSURLSessionConfiguration.defaultSessionConfiguration();
sessionConfig.requestCachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData;
var session = NSURLSession(configuration: sessionConfig);

Is there a reason why the session is ignoring the .ReloadIgnoringLocalAndRemoteCacheData?

1

There are 1 answers

0
Yaroslav On

From NSURLRequest Class Reference page

NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
NSURLRequestReloadRevalidatingCacheData = 5 // Unimplemented 

I guess, the constant is there but should not be used.