【发布时间】:2015-10-17 18:21:31
【问题描述】:
你好 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 loaded because the App Transport Security policy requires the use of a secure connection.
我看了下面的链接https://forums.developer.apple.com/thread/5835
并将以下代码添加到我的 info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict/>
</dict>
还是不行,有人有替代方案吗?
【问题讨论】:
-
我尝试了第二个结果,但它仍然不适合我
-
您是否尝试过在没有 NSExceptionDomains 键的情况下允许所有其他连接?
<key>NSAppTransportSecurity</key> <dict> <!--Include to allow all connections (DANGER)--> <key>NSAllowsArbitraryLoads</key> <true/> </dict> -
是的,这也没有解决我的问题