您是否为ATS(Apple Transport Security)添加了任意负载,例如:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
请注意,这是不安全的,您可能需要按域自定义 ATS 规则,例如:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>dl.dropboxusercontent.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
[更新]
如果我们更好地查看错误,我们可以看到关键
NSURLErrorFailingURLPeerTrustErrorKey
然后,Apple 关于HTTPS Server Trust Evaluation 的技术说明可能会有所帮助。
浏览我们阅读的文档
Domain=NSURLErrorDomain Code=-1202 "此服务器的证书是
无效的。您可能正在连接到假装的服务器
“example.com”可能会使您的机密信息面临风险。”
UserInfo=0x14a730 {NSErrorFailingURLStringKey=https://example.com/,
NSLocalizedRecoverySuggestion=你想连接到服务器吗
无论如何?, NSErrorFailingURLKey=https://example.com/,
NSLocalizedDescription=此服务器的证书无效。你
可能正在连接到伪装成“example.com”的服务器
这可能会使您的机密信息面临风险。
NSUnderlyingError=0x14a6c0 "此服务器的证书是
无效的。您可能正在连接到假装的服务器
“example.com”可能会使您的机密信息面临风险。",
NSURLErrorFailingURLPeerTrustErrorKey=}
嗯,就是这样,因为 NSURLErrorDomain 域中的错误 -1202 是 NSURLErrorServerCertificateUntrusted,这是由于 TSL 可能存在的问题。
所以此时我们需要检查TSL:
我们通过 CLI 检查证书:
$ openssl s_client -showcerts -host dl.dropboxusercontent.com -port 443
CONNECTED(00000003)
depth=2 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=dl.dropboxusercontent.com
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
---
Server certificate
subject=/OU=Domain Control Validated/CN=dl.dropboxusercontent.com
issuer=/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
---
No client certificate CA names sent
---
SSL handshake has read 4569 bytes and written 456 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : AES256-SHA
Session-ID:
Session-ID-ctx:
Master-Key: 50414926328455F36215516BEB0C40F1DD512C3C0989E0C090DC9277E754B35EFF0CE3AEA4D3FB524FFE071BE2D4426C
Key-Arg : None
Start Time: 1447281208
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
closed
我们可以在这里看到这个域支持TLSv1/SSLv3,
我们可以使用 SSL Quality Labs 的 SSL Server Test 在线执行此操作,并获得同样好的结果here。
我想知道这个问题是否与A couple users getting NSURLErrorServerCertificateUntrusted 重复
但是通过上面的 TSL 检查,我们可以清楚地看到有问题的域是正常的。
所以(简单)问题
您的电话时间和日期是否正确?