Xcode - Trying to add Self Signed Certificate (Not Verified)

Hello everyone,

I'm new as iOS developper, and I'm facing a WebSocket error due to my certificate...

Error Name : errSSLXCertChainInvalid Error Code : -9807

I have a server on a device, on which I want to start a secure WebSocket communication (wss://10.0.1.1:8080/). The server has my certificate .pem and works very well with my android App. When I choose Debug in Xcode buildConfiguration, there is no problem for the WebSocket communication (I think Debug doesn't check certificate during the Handshake process). But when I choose Release, I have the error because I didn't add the certificate on the iOS App. I don't really know how to add it properly...

But, I also tried to disable HTTPS checks (ATS) :

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

but that din't work either.

If anyone can help me?

Thank you

Replies

What API are you using for WebSocket? NSURLSession? Network framework? Or perhaps you’re doing this from within Safari? Or a web view?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi,

I'm using the WebSocket from react native framework => https://reactnative.dev/docs/network#websocket-support I don't really know if that call NSURLSession or Network framework ...

To better understand, why when I choose "Debug" build configuration, ssl cert verification seems to be disabled => The connection works

But when I choose "Release" build configuration, ssl cert verification seems to be enabled => The connection doesn't work

Can you tell me how to disable ssl cert verification when I choose "Release" to do my first test?

Thank you