For some users our app is throwing NSError while trying to call a secured server API using URLSession data task. Below is the detail of the error:
error-domain: NSURLErrorDomain
nserror-code: -1202
NSErrorPeerCertificateChainKey: ( "<cert(0x10a086200) s: wifisignon.shaw.ca i: DigiCert SHA2 Secure Server CA>", "<cert(0x10a04f600) s: DigiCert SHA2 Secure Server CA i: DigiCert Global Root CA>" )
NSLocalizedDescription: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “abc.xyz.net” which could put your confidential information at risk.
NSUnderlyingError: Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x282498240>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9843, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, kCFStreamPropertySSLPeerCertificates=( "<cert(0x10a086200) s: wifisignon.shaw.ca i: DigiCert SHA2 Secure Server CA>", "<cert(0x10a04f600) s: DigiCert SHA2 Secure Server CA i: DigiCert Global Root CA>" )}
We are using URLSession.shared.dataTask
for this GET API call. Problem is this error is occurring in few user's devices (300 users out of 5000) only. Since we can not reproduce the issue in our devices it is difficult to debug and find a proper fix. If it's a server certificate issue then why not occurring in all devices with same Model and OS version?