All http responses from a server come with the headers that inform our app not to cache the responses:
Cache-Control: no-cache
Pragma: no-cache
Expires: 0
>
Another possible solution is to modify the response object and clobber the Cache-Control headers from the server and replace them with your own desired values.
There are two places you could do that.
You could do it in a NSURLSessionDataDelegate in func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, willCacheResponse proposedResponse: NSCachedURLResponse, completionHandler: (NSCachedURLResponse?) -> Void), but if you do it there, then can no longer use the usual completion handler-based methods getting results from session tasks.
Another place you could do it is by defining a custom NSURLProtocol, which intercepts HTTP and HTTPS responses and modifies them.