app上线内外部版本号的问题

本文介绍了在iOS应用发布过程中遇到的版本号冲突问题,以及内部版本号(Bundle version)和外部版本号(Short version string)的区别。内部版本号用于内部迭代和测试,而外部版本号是用户在App Store上看到的版本。当需要修复已上传版本的bug时,可以修改内部版本号并保持外部版本号不变,以便重新上传。短版本字符串最多只能包含3个部分,如2.0.1。通过代码可以获取应用的版本号。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以前上线过程曾经遇到一个问题,就是已经打包上传了iTunes,但是发现里面有bug,还需要再修改重新打包,按理说再打包上传就可以了。可是发现重新打包再上传时,苹果会提示已经上传了一个版本为xxx的包,不能重复上传,但是之前提交的版本又不能上线,版本应该还是和他一样的啊,我改了是可以上传了,但是用户看到的版本就会丢一版。纠结之下找百度,发现其实ios版本号其实有两种,内部版本号和外部版本号,而刚才提示版本号冲突的,其实指的就是内部版本号,我们只需要把内部版本号修改,并保留之前的外部版本号,就可以再次成功上传了。

下面借用一段话来解释这两种版本号的区别。

Bundle version is the internal version number of your app. 
Short version string is the publically visible version of your app. 

So for example, if you iterate your version number every time you do an internal build for your beta testers (or whatever), your bundle version might be 2.0.0.12345b7, but you don't want the public to see that, so you set your short version string to 2.0. 

Short version string seems to be optional, so if you leave it blank then the bundle version is what people will see (i.e. that's what will be displayed on the App Store). 

Your short version string can't have more than 3 parts, e.g. 2.0.1 is okay, but 2.0.0.1 isn't. If you don't have a short version string, then the same rules apply to your bundle ID (basically the public app version has this restriction and the private app version doesn't).


就是说 Bundle version指的是你的内部版本号,Short version string是外部版本号。

例如,为了测试你每次都会创建一个版本,并且迭代版本号,,你的bundle version可能是2.0.0.1234567,但是你不想外部看到,所以你将short version设置为2.0


Short version是可选的,所以如果你将它留空了人们将会看到你的内部版本号(也就是在app store中展示的版本号)。

你的short version string 不能超过3部分,例如,2.0.1是可以的,但是2.0.0.1不可以。这样的规则同样也使用于你的app ID.(一般公开的应用版本号有这样的限制而内部的版本号没有)。



版本号用代码获取的方式如下:

代码实现获得应用的Verison号:

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];


[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

获得build号:

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

在Xcode中有两处可以修改你的版本号,如下图所示:




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值