Here is the code I am using:
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];
This works fine with WiFi. If I switch to LTE, it fails with:
NSURLErrorDomain Code=-1005. The network connection was lost.
Checked the server logs. The request doesn't even reach the server (Apache 2.4). Other sites are reachable with LTE. But my server is not reachable in Safari either. But it does work with Wifi. Any ideas/suggestions?