I have an Objective-C iPad application that makes a web service call which is failing as follows:
"CFNetwork SSLHandshake failed (-9824)"
"NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)"
The following code makes the call:
responseData = [NSMutableData data];
NSURL *loginurl = @"https://domain.com/4dAction/servicename/";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:loginurl];
NSString *params = [[NSString alloc] initWithFormat:@"user=%@&pass=%@",username.text,password.text];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
After some research it seemed that the solution could be to put some exceptions into ‘info.plist’ and this resulted in slightly different error messages but it still doesn’t work, the following is the section I added to 'info.plist' :
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>domain.com</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
This call is now failing with the error (there is now no "CFNetwork SSLHandshake failed" error as there prevously was):
"NSURLSession/NSURLConnection HTTP Load failed (kCFStreamErrorDomainSSL, -9802)"
The things that have changed since the last time this worked are as follows:
- iOS upgraded to version 9
- Web server moved from 4D running on MAC to 4D running on Windows.
- The domain name has changed and a new certificate issued.
Basically I am looking for a way to make the web service call work without an error.