我有一个下一个问题,我必须在我的info.plist文件中添加NSAppTransportSecurity密钥。
因为我有许多不同的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>但是在cordova构建iOS之后,我在我的info.plist中得到了如下内容:
<key>[object Object]</key>
<string>NSAppTransportSecurity</string>但是CFBundleURLTypes的端口是正常的。我做错了什么?
发布于 2016-06-16 15:24:37
您可以使用cordova-custom-config插件来实现这一点:
$ 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>发布于 2016-06-16 17:41:32
我确实同意DaveAlden的解决方案。但是,如果您只对在*-Info.plist文件中操作NSAppTransportSecurity感兴趣,那么您可以使用cordova-ios-security plugin
这个插件负责您在*-Info.plist文件中手动完成的工作
https://stackoverflow.com/questions/37851261
复制相似问题