The code works with WiFi but fails when I switch to LTE.
NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x17005dc70 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=54, _kCFStreamErrorDomainKey=1}},
Other sites are reachable via LTE. It looks like the server doesn't get the request.
Can anyone help?
NSString *dataUrlString = [NSString stringWithFormat:@"https://some_valid_server_name"];
NSURL *url = [NSURL URLWithString:dataUrlString];
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
request.HTTPMethod = @"POST";
NSURLSessionUploadTask *uploadTask = [session uploadTaskWithRequest:request
fromData:someData
completionHandler:^(NSData *data,NSURLResponse *response,NSError *error) {
if (error != nil)
NSLog(@"ERROR %@", error);
}];
[uploadTask resume];