Ios Swift2.0 HTTP请求不工作
你好,Stackoverflow 在我将我的swift应用程序移动到Swift2.0后,我一直遇到此错误:Ios Swift2.0 HTTP请求不工作,ios,swift,xcode7,Ios,Swift,Xcode7,你好,Stackoverflow 在我将我的swift应用程序移动到Swift2.0后,我一直遇到此错误: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. The resource could not be l
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
我看了下面的链接
并将以下代码添加到my info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict/>
</dict>
NSAppTransportSecurity
NSAllowsArbitraryLoads
NSExceptionDomains
它仍然不起作用,有人有其他解决方案吗?它不是一个
Swift 2.0
问题,它实际上是一个iOS 9.0
问题,其中iOS 9.0
强制web流量超过https
设置下面的标志允许http
流量
您必须在.plist文件的NSAppTransportSecurity字典下将NSAllowsArbitraryLoads密钥设置为YES。希望这有帮助
查看此链接@和此链接。我尝试了第二个结果,但对我来说仍然无效。您是否尝试过只允许所有其他连接而不使用NSExceptionDomains密钥
NSAppTransportSecurity NSAllowsArbitraryLoads
是的,但这并不能解决我的问题,而且还不能正常工作。它与ios9无关。