Difference between Xcode version (CFBundleShortVersionString) and build (CFBundleVersion)
Asked Answered
A

4

96

App Target Summary

In Xcode 4, I see this for my target summary:

The "Version" input corresponds to CFBundleShortVersionString in the info.plist file, and the "Build" input corresponds to CFBundleVersion.

What's the difference between these two? I see a lot of people on the internet wanting to put the same value in for both, and my suspicion is that is for backwards compatability.

I have two questions:

1) If I were starting from scratch, what would be the best practice for versioning your app?

2) In all previous releases of my app, I only used CFBundleVersion. In order to not mess up the upgrade process, should I continue to increment CFBundleVersion the same way I have been or is it possible to switch to the "right way", assuming one exists?

Airliner answered 29/7, 2011 at 17:43 Comment(2)
This is a duplicate of https://mcmap.net/q/63498/-version-vs-build-in-xcode but perhaps this version is better stated (and has a screenshot).Peristalsis
Is there anything you had to do to show the Build field in your Summary? I only see a Version, but no Build field.Calyptrogen
S
69

The Apple document "Information Property List Key Reference" says that CFBundleShortVersionString represents a release version, whereas CFBundleVersion represents any build, released or not. Also, CFBundleShortVersionString can be localized, though I don't know why you'd want to, since they say it is supposed to be "a string comprised of three period-separated integers". For a release build, it would be reasonable to make the two numbers the same. For a development build, you might tack something else on to the CFBundleVersion, maybe another dot and integer.

Stand answered 30/7, 2011 at 6:10 Comment(7)
But if I've currently been using 1.3.1 as my CFBundleVersion and nothing as my CFBundleShortVersionString, and I want to switch to using CFBundleVersion to represent internal builds, then I need to at least start with an integer higher than 1.3.1, right? Or is making that switch just asking for trouble?Airliner
The Version (CFBundleShortVersionString) is the only thing that will matter for submitting to Apple. The Build (CFBundleVersion) is for use however you like in development, or to show within your app. Use octal (base-8) and iterate in reverse by 12, if you like.Trichotomy
nekno: Actually the CFBundleVersion is what matters to Apple. Check this error message Apple give when submitting an app: "The binary you uploaded was invalid. The key CFBundleVersion in the Info.plist file must contain a higher version than that of the previously uploaded version."Loop
Some countries use numerals other that Modern Arabic used in western world, like Eastern Arabic (٠‎, ١‎, ٢‎, ٣‎, ٤‎, ٥‎, ٦‎, ٧‎, ٨‎, ٩‎), or Hebrew (א ,ב, ג, ד, ה, ו, ז, ח, ט) - and those two are also written right to left. There are many more other numeral systems out there (see en.wikipedia.org/wiki/Category:Numerals) So my guess is that's what Apple means by "localizable" version number.Runyon
By the way, the three digits with punctuation is not required. I have been using instead a date-time value such as 201606070620 for both values in a shipping iOS 7-8-9 app.Helman
And the version number can be followed with a "alpha" or "beta". The 3 integers are not the final solution to versioning and luckily the syntax is not enforced by apple (but the CFBundleVersion is)Fayina
Apple's tech note TN2420 clarifies how the CFBundleVersion and CFBundleShortVersionString actually work in practise, confirming Xcode (9)'s labelling of CFBundleVersion simply as a build number.Grassquit
E
3

To JWWalker's question on why you would want to localize CFBundleShortVersionString, that would be the decimal separator. For example in locales where the decimal separator is actually a comma, the version "1.5" would be "1,5".

Epanaphora answered 7/9, 2011 at 15:29 Comment(3)
IMO you don't need to localize version numbers. I live in a region where the decimal separator is a comma (Germany), and I'm used to version numbers separated by a dot. In fact, I can't remember that I ever saw a version number with a comma.Keir
I also live in a region using comma as decimal separator, though 1,3,1 is quite a odd value, 1.3.1 seems much better.Kaciekacy
I think it means that you can have different versions of the app for different regions. 1.2.1 > en.lproj 1.2.2 > fr.lproj Though the whole plist is copied when you localize the file so both version numbers copied in so both 'can be localized'Wells
R
1

Quick Fix:

Just add the CFBundleShortVersionString to the plist file and edit your version.

  1. Reveal your InfoPlist.strings
  2. Highlight it and paste the code below in (assuming its in source code mode)

{"CFBundleShortVersionString" = "1.1";}

  1. Change the 1.1 to whatever your new build is.
  2. Build & submit with no more error!

enter image description here

Rother answered 22/7, 2013 at 21:25 Comment(0)
P
1

See the Apple documentation on uploading binaries.

Numbering versions and builds: iTunes Connect extracts its prerelease version number and build number from the binary. The prerelease version number is the Xcode Version number, or the "Bundle version string, short" key in the Info.plist. The build number is the Xcode Build number, or the "Bundle version" key in the Info.plist. The prerelease version number and build number will be shown on the Prerelease tab, as described in Viewing Builds.

Uploading a Binary For An App

Phoebephoebus answered 8/2, 2015 at 11:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.