gpt4 book ai didi

ios - VS Cordova : is there any way to apply different config. xml 设置取决于所选配置?

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:01:51 26 4
gpt4 key购买 nike

我需要使用不同的应用程序 ID,因为为 com.myapp 和 com.beta.myapp 提供了两个配置文件。现在,每次我将当前配置从 Debug 更改为 Release 时,我都必须更改 config.xml 中的 widget:id,反之亦然。这可以自动化吗?我知道我可以通过实现 BeforeBuild/BuildDependsOn 处理程序来调整 .jsproj,甚至可以使用 web.config 转换。是否有更简单、最好是内置的方法来做同样的事情?

注意:自定义 node.js 和/或 VS 文件不是一种选择,因为我更喜欢修改作为项目存储库一部分的文件,以便能够与代码库一起存储和分发更改。

最佳答案

问题已经解决。

首先,在 res\native\ios\cordova 中创建以下文件:

// build.xcconfig
// The file contains general iOS settings, e.g.
CODE_SIGN_IDENTITY = <your iOS identity>
// build-debug.xcconfig
// The file contains beta specific iOS settings
#include "build.xcconfig"
BUNDLE_ID = com.your.app.beta
PROVISIONING_PROFILE = <profile GUID>
// build-release.xcconfig
// The file contains release specific iOS settings
#include "build.xcconfig"
BUNDLE_ID = com.your.app
PROVISIONING_PROFILE = <profile GUID>

参见 Build Settings Reference支持设置的完整列表。请注意,BUNDLE_ID 是一个自定义常量,如下所述。

如果您想在解决方案资源管理器中将文件组合在一起,只需按如下方式编辑您的 .jsproj 文件:

<Content Include="res\native\ios\cordova\build.xcconfig" />
<Content Include="res\native\ios\cordova\build-debug.xcconfig">
<DependentUpon>build.xcconfig</DependentUpon>
</Content>
<Content Include="res\native\ios\cordova\build-release.xcconfig">
<DependentUpon>build.xcconfig</DependentUpon>
</Content>

最后,按如下方式编辑您的 config.xml:

<widget ... id="com.your.app" ios-CFBundleIdentifier="$(BUNDLE_ID)">
...
</widget>

这会将 iOS 包 ID 设置为您在目标 .xcconfig 中分配的任何值。

关于ios - VS Cordova : is there any way to apply different config. xml 设置取决于所选配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29147970/

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