已经在这里找到了相同的线程,但这并没有解决我的问题。
我在 info.plist中添加了NSAppTransportSecurity
和。NSAllowsArbitraryLoads
截屏:
添加了本文中的以下代码。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>pm-admin.smartwcm.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowInsecureHTTPSLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSThirdPartyExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
</dict>
</dict>
我正在使用 HTTP REST API。运行项目时出现以下异常:
System.Net.WebException:发生 SSL 错误,无法与服务器建立安全连接。---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-1200 “发生 SSL 错误,无法与服务器建立安全连接。” UserInfo={NSLocalizedRecoverySuggestion=您还是要连接到服务器吗?
我错过了什么或做错了什么?