Ios NSAppTransportSecurity的Phonegap modify config.xml

Ios NSAppTransportSecurity的Phonegap modify config.xml,ios,xml,cordova,plist,Ios,Xml,Cordova,Plist,我还有一个问题,我必须将NSAppTransportSecurity密钥添加到我的info.plist文件中 因为我有许多不同的config.xml用于测试、开发和生产服务器,所以手动将NSAppTransportSecurity密钥添加到plist中是不好的 这可以在config.xml本身内部完成吗 我试过这个: <manifest device="ios" tag="plist/dict"> <key>CFBundleURLTypes</key>

我还有一个问题,我必须将NSAppTransportSecurity密钥添加到我的info.plist文件中

因为我有许多不同的config.xml用于测试、开发和生产服务器,所以手动将NSAppTransportSecurity密钥添加到plist中是不好的

这可以在config.xml本身内部完成吗

我试过这个:

<manifest device="ios" tag="plist/dict">
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
        ...
        </dict>
    </array>

    <!--Here is my own:-->
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
</manifest>

CbundleurlTypes
...
NSAppTransportSecurity
NSAllowsArbitraryLoads
但在cordova构建iOS后,我在info.plist中得到了以下信息:

<key>[object Object]</key>
<string>NSAppTransportSecurity</string>
[对象]
NSAppTransportSecurity
但是CbundleUrlTypes可以正常移植。我做错了什么?

您可以使用插件来实现这一点:

$ cordova plugin add cordova-custom-config
然后添加到config.xml:

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

NSAllowsArbitraryLoads

我确实同意达维登的解决方案。但是如果
NSAppTransportSecurity
是您在
*-Info.plist
文件中唯一感兴趣的操作,那么您可以使用


此插件负责您在
*-Info.plist
文件中手动执行的任务,只需将平台添加到IOS,然后使用默认的Info.plist文件访问