启用允许任意加载应用程序传输安全设置在 XCODE 9.2 和 iOS 11.2 中不起作用

Enable Allow arbitrary Loads of App Transport Security Setting not working in XCODE 9.2 and iOS 11.2

我使用相同的设置来启用任意加载,但现在我遇到了一些 issues.I 使用 alamofire 进行 json 解析。

info.plist 设置:

错误是:

您的传输信息 plist 层次结构应该是这样的

NSAppTransportSecurity provides the network layer security and only allow http secured urls.

有两种方法可以解决这个问题:

案例一:

在您的代码中,您使用的是不安全的 url,将 http:// 替换为 https://,然后它将起作用。

案例二:

如果您没有启用 ssl url 那么,允许您的 url 在 Exception Domains 中作为: