I am using NSUrlSession for calling backend APIs. Sometimes the APIs are working but sometimes i am getting the issues like
HTTP load failed (error code: -999), HTTP load failed (error code: -1200)
Refer below :- Screenshot from Xcode logs.
I have researched regarding it and the possible solutions suggested is to use App Transport Security Settings and I am already using it.
Here is the screenshot from info.plist file of my project.
Here below is the code i am using :-
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request uploadProgress:^(NSProgress * _Nonnull uploadProgress) {
} downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
} completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSInteger statusCode = [httpResponse statusCode];
completionBlock();
}];
[dataTask resume];
So not able to figure out what exactly causing NSURLSessionDataTask to fail. Even completion block is not called.
Any suggestions?
Thanks,