Hi,
I have a private https url hosted on our organisation's Apache server from which, I am trying to fetch data for my app. But am getting the following error:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600002421290>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey=(
"<cert(0x7f8952890c00) s: ~~~~~~~~~~~ i: DEN1-SSLCA-001-CA>",
"<cert(0x7f895282e200) s: ~~~~~~~~~~~ i: DEN1-SSLCA-001-CA>"
), NSUnderlyingError=0x60000186f5d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600002421290>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x7f8952890c00) s: ~~~~~~~~~~~ i: DEN1-SSLCA-001-CA>",
"<cert(0x7f895282e200) s: ~~~~~~~~~~~ i: DEN1-SSLCA-001-CA>"
)}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://~~~~~~~~~~~/***************, NSErrorFailingURLStringKey=https://~~~~~~~~~~~~~/**************, NSErrorClientCertificateStateKey=0}
~~~~~~~ is my server host
************ is my url or api
I get the expected response, when I give
App Transport Security Settings -> Exception Domains -> ~~~~~~~~~~~~~ -> NSExceptionAllowsInsecureHTTPLoads is set to YES.
Is this the only way I can achieve the result?
Becuase I see many posts stating the use of App Transport Security Settings isn't good.
Please help and guide me.