I'm trying to download a small data file using NSURLSession
, but the completion handler is never called (where "never" means I waited long after the specified timeout).
NSURLSessionConfiguration* config =
NSURLSessionConfiguration.ephemeralSessionConfiguration;
config.timeoutIntervalForResource = 120.0;
config.timeoutIntervalForRequest = 120.0;
NSURLSession* session = [NSURLSession sessionWithConfiguration: config];
[session dataTaskWithURL: inURL
completionHandler:
^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error)
{
...
}];
I'm trying to update some old code that used the deprecated NSURLConnection
class, and am using the same URL, so I know that the URL is good.
Did you call -resume
on the task? Everyone makes that mistake at least once in their life (-: Myself, I’ve made it many times!
I'm trying to update some old code that used the deprecated
NSURLConnection
class
Good for you!
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"