xcode Cordova 应用程序中的 iOS 内部版本号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24116607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:02:39  来源:igfitidea点击:

iOS build number in Cordova app

iosxcodecordova

提问by Ade

Using Cordova 3.5.0, when I run cordova prepare iosit overwrites my build number as well as the app's version number, using the version string from config.xml.

使用 Cordova 3.5.0,当我运行cordova prepare ios它时,使用config.xml.

From:

从:

<widget id="tld.domain.app" version="1.0.1"  

It sets the CFBundleVersionthe same as the short version:

它将CFBundleVersion设置为与短版本相同:

enter image description here

在此处输入图片说明

So I have to keep manually keep resetting my build number to my format which is YYYYMMDD.

所以我必须手动不断地将我的内部版本号重置为我的格式,即YYYYMMDD.

Ideally I'd like it to either leave the build number alone, or be able to set it explicitly in the config.xmlfile.

理想情况下,我希望它要么保留内部版本号,要么能够在config.xml文件中明确设置它。

Are either of these possible?

这两种都有可能吗?

回答by Ade

I found the answer in this resolved issue.

我在这个已解决的问题中找到了答案。

There are separate versionCodeattributes (separate to version) for iOS and Android, that need to be added to your config.xml file:

iOS 和 Android有单独的versionCode属性(与 分开version),需要添加到您的 config.xml 文件中:

<widget ... android-versionCode="201406092" ios-CFBundleVersion="201406092"

回答by Tony B

This post herewas a little clearer to me, a little more complete, so I mention it just in case it helps. Note that, effectively, it is almost the exact same as what Ade said. I only provide it because the first time I read Ade's answer, I was confused and did not fully understand his answer until I saw the answer below.

这篇文章在这里更清楚一点对我来说,多一点完整的,所以我说出来,以防万一它帮助。请注意,实际上,它与 Ade 所说的几乎完全相同。我提供它只是因为我第一次阅读Ade的答案时,我很困惑,直到看到下面的答案才完全理解他的答案。

If you want to separate the build number from the version number, you can add the following attributes to the widgettag in your config.xml:

version="VERSIONNR" android-versionCode="BUILDNR" ios-CFBundleVersion="BUILDNR"

so the complete tag, with those attributes included, looks something like this:

<widget id="APPID" version="VERSIONNR" android-versionCode="BUILDNR" 
ios-CFBundleVersion="BUILDNR" xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">

(text in uppercase are placeholders)

如果要将内部版本号与版本号分开,可以widget在 config.xml 中的标记中添加以下属性:

version="VERSIONNR" android-versionCode="BUILDNR" ios-CFBundleVersion="BUILDNR"

所以包含这些属性的完整标签看起来像这样:

<widget id="APPID" version="VERSIONNR" android-versionCode="BUILDNR" 
ios-CFBundleVersion="BUILDNR" xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">

(大写的文本是占位符)