如何将NSAppTransportSecurity添加到Cordova项目 [英] How to add NSAppTransportSecurity to Cordova project

查看:182
本文介绍了如何将NSAppTransportSecurity添加到Cordova项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事离子科尔多瓦项目.该应用程序必须为iOS 9版本的未配置应用传输安全例外".

I'm working on a ionic cordova project. That application needs to be onfigured App Transport Security Exceptions for iOS 9 version.

有人知道如何将以下配置添加到cordova项目配置文件中吗? (config.xml)

Does anyone know how to add below configuration to the cordova project configuration file? (config.xml)

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

此致

推荐答案

最简单的解决方案可能是使用插件.看看 cordova-plugin-transport-security

The easiest solution is probably by using a plugin. Take a look at cordova-plugin-transport-security

cordova plugin add cordova-plugin-transport-security --save

您可以在其plugin.xml文件中看到其如何修改plist值.

You can see in its plugin.xml file how it modifies the plist value.

<platform name="ios">
  <config-file target="*-Info.plist" parent="NSAppTransportSecurity">
      <dict>
          <key>NSAllowsArbitraryLoads</key>
          <true/>
      </dict>
  </config-file>
</platform>

这篇关于如何将NSAppTransportSecurity添加到Cordova项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆