NSURLSession given error code of -1001

We are doing Head Request using NSURLSession,

The request is,

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:contentPlaybackURL cachePolicy:1 timeoutInterval:15];

[request addValue:@"1" forHTTPHeaderField:@"getContentFeatures.dlna.org"]; [request addValue:@"1" forHTTPHeaderField:@"getAvailableSeekRange.dlna.org"]; [request setHTTPMethod:@"HEAD"];

NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration] delegate:nil delegateQueue:nil]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { requestError = [error copy];

    taskComplete = YES;
}];

Getting error with no error message and error code is -1001, because of low bandwidth, where has in high bandwidth its working.

If we use the "NSURLSessionTaskDelegate" will it give additional information like error message ?

Getting error with no error message and error code is -1001, because of low bandwidth, where has in high bandwidth its working.

Error -1001 is NSURLErrorTimedOut. That seems reasonable to me: When you set a really short timeout, you can expect to see timeout errors on low-bandwidth networks.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NSURLSession given error code of -1001
 
 
Q