Difference between Xcode version (CFBundleShortVersionString) and build (CFBundleVersion)

Objective CXcode

Objective C Problem Overview


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?

Objective C Solutions


Solution 1 - Objective C

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.

Solution 2 - Objective C

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".

Solution 3 - Objective C

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

Solution 4 - Objective C

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPhilip WaltonView Question on Stackoverflow
Solution 1 - Objective CJWWalkerView Answer on Stackoverflow
Solution 2 - Objective CArjunView Answer on Stackoverflow
Solution 3 - Objective CLouieView Answer on Stackoverflow
Solution 4 - Objective CGilesDMiddletonView Answer on Stackoverflow