苹果开发者文档介绍到
Key |
Xcode name |
Summary |
CFBundleShortVersionString |
“Bundle versions string,short” |
(Localizable) The release-version-number string for the bundle. |
CFBundleVersion |
“Bundle version” |
(Recommended) The build-version-number string for the bundle. |
CFBundleShortVersionString 为发布版本号,标识应用程序发布的正式版本号。
CFBundleVersion 为构建版本号,标识应用程序构建(发布或未发布)的内部版本号。
版本号通常由三个整数句点分隔组成,例如 1.2.3
命名规则:
- 第一位数字,也称主版本号,表示重要功能或重大更新
- 第二位数字,次要功能更新
- 第三位数字,表示正常维护更新
AppStore 发布使用的是 CFBundleShortVersionString 短版本号。开发者上传应用进行审核,如未通过则需要修复问题,再次打包发布 CFBundleShortVersionString 可以保持不变,但是 CFBundleVersion 需要不断增加。CFBundleVersion 一般不对外公开,在团队内部使用。
场景分析:
我的应用首次上传 AppStore 发布版本号为 1.2.3
(CFBundleShortVersionString),构建版本号为 1.0.1
(CFBundleVersion)。但应用商店审核未通过,修复问题之后再次打包上传 AppStore,版本号不变为 1.2.3
,但是 Build Version 一定递增 1.0.2
、1.0.3
...。当这次应用审核通过后,用户可在 AppStore 更新 1.2.3
版本,下次上传 AppStore 发布正式版本号将递增使用 1.2.4
。