Hi everyone,
I have a problem while trying to session.dataTaskWithRequest in a function to read gzip from URL.
The server side changes ".gzip" to ".bin" and stores the file.
I want to read the file with ".bin". However, The network connection was lost.
However, a "The network connection was lost" error will occur.
Could you tell me how to solve this problem?
server side
file name : ***.bin
(This bin file is a gzip file.)
following the code:
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
NSURL *url = [NSURL URLWithString:@"http://...../***.bin"];
NSURLSessionDataTask *task = [session dataTaskWithURL: url
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"error [%@]", [error localizedDescription]);
}
else {
NSLog(@"success");
}
}];
[task resume];