Search code examples
ios11xcode9-beta

xCode 9 - iOS 11: NSURLConnection - sendAsynchronousRequest fails


I just downloaded the latest version of xCode (9.0 beta (9M136h)).

However, when I try to make a request to my server in iOS 11 simulator (Using NSURLConnection sendAsynchronousRequest), an error is received:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807) NSURLConnection finished with error - code -1202

NSError object contains the message - @"NSLocalizedDescription" : @"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “***” which could put your confidential information at risk."

The plist contains:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

so it is not the problem in this case (I guess)

Needless to say that it is working in iOS 10/9/8

Any suggestions?

Thanks in advance!


Solution

  • For all of you who get this error in iOS 11, please make sure you're working against valid (secured) certificate in your server.

    In our case, the certificate wasn't strict enough.

    Once our server guy integrated new valid certificate, the problem has gone.

    One way to check if the certificate is secured, is to past the problematic link in the browser.

    As a result, you might see that the connection is not secured:

    enter image description here