0

I have an application that makes calls on my localhost API. For testing purposes I have created a self-signed certificate in order for SSL to work.

On iOS side I make calls using the sharedsession NSURLSession instance, where I cannot set a custom delegate and challenge with the untrusted certificate.

Does anyone knows how to deal with that situation? The error I get is the following.

2015-11-15 20:59:30.547 Bookings2[4374:1500426] CFNetwork SSLHandshake failed (-9806)
2015-11-15 20:59:30.548 Bookings2[4374:1500426] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
Error: Optional(Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9806, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x7f849b80b8a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9806, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9806}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://localhost:3000/version?api_key=TEST, NSErrorFailingURLStringKey=https://localhost:3000/version?api_key=TEST, _kCFStreamErrorDomainKey=3})

Thanks

SWE
  • 485
  • 1
  • 4
  • 19
  • possibly duplicate of http://stackoverflow.com/questions/20230169/nsurlsession-server-with-self-signed-cert – Adi Nov 15 '15 at 19:25
  • Seems but the accepted solution doesn't use the SharedSession. If there is no solution to that problem I'll try that way. – SWE Nov 15 '15 at 19:34

0 Answers0