For testing purpose, we use a self-signed cert, loaded as a bundle resource for network requests.
It works fine on Xcode8 + iOS10 devices and simulators.
On Xcode9 and iOS 11, however, prompts with error as:
----------------
<APIClient.swift> call [#77]
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x1c0111f70>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey=(
"<cert(0x1070fb600) s: *.😎 i:🙂>",
"<cert(0x1070fce00) s:🙂 i: 2048 offline root>",
"<cert(0x1070fd600) s: 2048 offline root i: 2048 offline root>"
), NSUnderlyingError=0x1c465e180 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x1c0111f70>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x1070fb600) s: *.😎 i:🙂>",
"<cert(0x1070fce00) s:😎 i: 2048 offline root>",
"<cert(0x1070fd600) s: 2048 offline root i: 2048 offline root>"
)}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https:/
----------------
It can be resolved by adding:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I wonder if the security policy is changed, like self-signed cert is totally prohibited on iOS 11?
If yes, is there a link/documentation reference?