gpt4 book ai didi

ios - 在Cordova iOS应用程序中将字段添加到info.plist

转载 作者:行者123 更新时间:2023-12-01 18:05:56 24 4
gpt4 key购买 nike

我需要创建自定义插件,以将条目添加到cordova / angular4 iOS应用程序的info.plist中。 (在这种情况下,如果按下主页按钮,则退出应用程序)

我需要添加行:

<key>UIApplicationExitsOnSuspend</key>
<true/>

这是我编写的插件的内容(可能不正确,因为我无法对其进行测试)。
<config-file target="*-Info.plist" platform="ios" parent="UIApplicationExitsOnSuspend">
<array>
<boolean><true/></boolean>
</array>
</config-file>

将这个插件“导入”到config.xml中需要什么,以便每次执行 cordova build ios plist文件时都会有我需要的条目?

我已经阅读了这篇文章,但我不知道它是如何完成的。

Add entry to iOS .plist file via Cordova config.xml

Cordova: Modifying *-Info.plist from plugin.xml

最佳答案

经过几个小时的搜索和几次尝试,实际上只需添加即可:

<config-file target="*-Info.plist"parent="UIApplicationExitsOnSuspend">
<true/>
</config-file>
(就我而言,这阻止了应用程序在后台运行)
右移到 config.xml中,并将其嵌套在 <platform name="ios">标记内,就好像它是您的插件一样。并且此设置将在 *-info.plist 期间添加到cordova build ios中,而无需手动安装自定义插件
提示:我首先被误认为,而不是 *中的 target="*-Info.plist"必须是您应用的标题,但是实际上它必须有一个 *符号,而cordova本身会为您的应用找出info.plist的名称。

关于ios - 在Cordova iOS应用程序中将字段添加到info.plist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44495518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com