CFNetwork SSLHandshake failed (-9824) NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)

  1. From NSURLConnection to NSURLSession worked for me

I was able to solve as following( NSURLConnection is deprecated and you need to use NSURLSession) :

NSURL *URL = [NSURL URLWithString:@"http://example.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

[NSURLConnection sendAsynchronousRequest:request
                                queue:[NSOperationQueue mainQueue]
                    completionHandler:^(NSURLResponse *response, NSData  *data, NSError *error) {
 // ... 
}];

converted to:

NSURL *URL = [NSURL URLWithString:@"http://example.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request
                                     completionHandler:
 ^(NSData *data, NSURLResponse *response, NSError *error) {
     // ...
  }];

[task resume];

From NSURLConnection to NSURLSession

  1. Also included in Info.plist see documentation:

Info.plist reference

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
  <key>yourdomain.net</key>
  <dict>
  <key>NSIncludesSubdomains</key>
  <true/>
  <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
  <true/>
  <key>NSTemporaryExceptionMinimumTLSVersion</key>
  <string>1.2</string>
  <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
  <false/>
  </dict>
  </dict>
</dict>
  1. And ultimately

Announcement: CFNetwork SSLHandshake failed (-9824) while integrating Login with Amazon SDK for iOS Back to Category Back to Category

CFNetwork SSLHandshake failed (-9824) while integrating Login with Amazon SDK for iOS Back to Category Back to Category

Just change to yourdomain.net from api.amazon.com

Hope it helps.

Leave a Comment