应用传输安全密钥在 info.plist 中不起作用
App Transport Security Key not working in info.plist
我的info.plist设置如下:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
但是,当将 "www.google.com" 加载到 UIWebView 时,我仍然收到 ATS 安全错误:
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
准确值为
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
进入 plist 后,确保它在项目设置信息选项卡中正确显示
在我的例子中,问题实际上是 info.plist 文件没有正确分配给我的目标。 Plist 中的密钥是正确的。在某些时候,我将我的应用程序分为精简版和专业版的 2 个目标,每个目标都有自己的 info.plist,但是它们没有正确分配。
这可以在Target > Build Settings > Search for "Info.plist" > Change path under targeting
下查看
我的info.plist设置如下:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
准确值为
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
进入 plist 后,确保它在项目设置信息选项卡中正确显示
在我的例子中,问题实际上是 info.plist 文件没有正确分配给我的目标。 Plist 中的密钥是正确的。在某些时候,我将我的应用程序分为精简版和专业版的 2 个目标,每个目标都有自己的 info.plist,但是它们没有正确分配。
这可以在Target > Build Settings > Search for "Info.plist" > Change path under targeting