【发布时间】:2015-10-22 08:08:45
【问题描述】:
我正在使用 iOS 9 中的以下代码向 https 服务器发送发布请求
[NSURLConnection sendSynchronousRequest:request returningResponse:&requestResponse error:&err];
但我收到以下错误
CFNetwork SSLHandshake failed (-9824)
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)
我已尝试将异常添加到 info.plist,如下所示:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.myserver.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
我也试过
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
它可以在真实设备上运行,但不能在模拟器上运行
【问题讨论】:
标签: ios ios-simulator ios9