I am using NSURLSession in my application to send the data to server. Server URL may be arbitary , It may change dynamically
So I have added following in my plist file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
because user can change the server URL manually from settings page inside my application. So when I try to send data , NSURLRequest will be configured with latest server URL.
My code is
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSURLSession *session = [NSURLSession sharedSession];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
//some of my codes
}] resume];
I will create NSMutableURLRequest from dynamic URL which is entered by user in settings page(eg. https://100.100.25.25/sample).
NSMutableURLRequest *dataRequest = [NSMutableURLRequest requestWithURL:serverAddress
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
when I try to access the server using NSURLSession with latest server URL then Its always return error "NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)".
Note : If my URL only contain characters(https://sample.com/sample) then its working fine. If it contains some number(https://100.100.25.25/sample) then its not working. Given URL is not live. Its just to say Please help me to find the issue . Thanks in advance