NSURLSession dataTaskWithRequest:completionHander: Pain Resolved
I think I’ve just come across the iOS equivalent of a cure for chronic pain. If you’ve ever had chronic pain, an aching back, a stiff knee joint and worried about what that means, and bugged doctor after doctor, tried therapy after therapy to no avail until the cure pops you in the head, then this post is a Brockmann-equivalent.
I’d been struggling with networking services for the better part of three years in a commercial app I’ve built for a non-profit association that I am a member of, and then, in a completely unrelated circumstance, I stumbled across the answer.
The objective-C class method,
NSURLSession dataTaskWithRequest:completionHandler: behaves like it caches frequently called URLs because… it caches the results of frequently called URLs, returning the cached results!
To turn off this default behavior, I had to set the session.configuration.URLCache to NULL, not nil.
session.configuration.URLCache = NULL;
This post has already been read 0 times!Edit