根据以下错误消息,我需要在info.plist中设置什么来启用HTTP模式?
传输安全性已阻止明文HTTP(HTTP://)资源因为它是不安全的。可以通过以下方式配置临时异常应用程序的Info.plist文件。
假设我的域名是example.com。
根据以下错误消息,我需要在info.plist中设置什么来启用HTTP模式?
传输安全性已阻止明文HTTP(HTTP://)资源因为它是不安全的。可以通过以下方式配置临时异常应用程序的Info.plist文件。
假设我的域名是example.com。
当前回答
**终于!!!已解决的应用程序传输安全**
1. Follow the follow the screen shot. Do it in Targets info Section.
其他回答
默认情况下,iOS仅允许HTTPS API。由于HTTP不安全,您必须禁用应用程序传输安全性。有两种禁用ATS的方法:-
1.在项目info.plist中添加源代码,并在根标记中添加以下代码。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
2.使用项目信息。
单击左侧窗格中项目上的项目,选择项目作为目标,然后选择信息选项卡。您必须按照以下结构添加字典。
对于Cordova,如果您想将其添加到ios.json中,请执行以下操作:
"NSAppTransportSecurity": [
{
"xml": "<dict><key>NSAllowsArbitraryLoads</key><true /></dict>"
}
]
并且它应该位于:
"*-Info.plist": {
"parents": {
}
}
在swift 4和xocde 10中,将NSAllowsArbitraryLoads更改为允许任意加载。所以它将是这样的:
<key>App Transport Security Settings</key>
<dict>
<key>Allow Arbitrary Loads</key><true/>
</dict>
使用NSAppTransportSecurity:
您必须在info.plist文件中的NSAppsTransportSecurity字典下将NSAllowsArbitraryLoads键设置为YES。