我正在使用IP地址与API连接问题 . 即使我已将以下代码添加到plist,它仍然显示如下错误:
“http://xx3.xx.xx8.xx7/xxx/xxx/错误:无法加载资源,因为App Transport Security策略要求使用安全连接 . ”
这是我添加到plist的代码
<key>xx3.xx.xx8.xx7</key>
<dict>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</key>
2 回答
文件Allowing Insecure Connection to a Single Server here . 所以你必须将
NSAppTransportSecurity
添加到你的info.plist文件中,就像流动一样(在源代码中显示Info.plist,在Xcode中右键单击Info.plist "Open As" - > "Source Code")To configure a per-domain exception:
编辑Infor.plist文件后如下所示:
Or disable ATS:
编辑Infor.plist文件后如下所示:
Simple & Easiest Solution just in 3 Steps
添加以下两个属性并再次运行...快乐编码:-)