Why iOS8 SSL requests fail intermittently after mi

2020-06-17 06:45发布

问题:

I have an iOS app, which works fine on iOS7. Now we are testing it on iOS8, and when running under iOS8, we have SSL issues. Some (but not all) SSL requests fail. All requests are against the same server, with a SSL certificate that is valid, and works on desktop, and works when the same app is running iOS7.

The error we are getting is kCFURLErrorSecureConnectionFailed, which Apple documents to be:

The secure connection failed for an unknown reason.

Also, I get the following logged in the console:

CFNetwork SSLHandshake failed (-9846)

We are using NSURLConnection. We have implemented connection: willSendRequestForAuthenticationChallenge, but it does not get called when we get the error.

Do anyone know if this is a known iOS8 issue? What would be my next steps to finding out, why these requests fail?

回答1:

The error you are seeing is a SecureTransport error. Error -9846 is errSSLBadRecordMac. This is a transport level error in the SSL mechanism, and is typically caused by a bug in the implementation - Apple's, not yours in this case. Please reduce it to a test case and file a bug:

https://bugreport.apple.com



回答2:

This turned out to actually be a bug in the firmware for the loadbalancer running the site. We upgraded the firmware, and everything now works as expected.