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?

gcamp
  • 14,622
  • 4
  • 54
  • 85
Philip Walton
  • 29,693
  • 16
  • 60
  • 84
  • 3
    This is a duplicate of http://stackoverflow.com/questions/6851660/version-vs-build-in-xcode-4 but perhaps this version is better stated (and has a screenshot). – Daniel Dickison Jul 29 '11 at 18:24
  • Is there anything you had to do to show the Build field in your Summary? I only see a Version, but no Build field. – Kenny Wyland Sep 15 '11 at 00:16

4 Answers4

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.

JWWalker
  • 22,385
  • 6
  • 55
  • 76
  • 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? – Philip Walton Aug 02 '11 at 19:33
  • 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. – nekno Aug 11 '11 at 18:48
  • 16
    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." – malhal Nov 02 '12 at 21:12
  • 11
    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 http://en.wikipedia.org/wiki/Category:Numerals) So my guess is that's what Apple means by "localizable" version number. – Ruslan Ulanov Jul 31 '14 at 22:14
  • 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. – Basil Bourque Jun 08 '16 at 01:16
  • 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) – Lothar Jun 24 '16 at 19:05
  • Apple's tech note [TN2420](https://developer.apple.com/library/content/technotes/tn2420/_index.html) clarifies how the `CFBundleVersion` and `CFBundleShortVersionString` actually work in practise, confirming Xcode (9)'s labelling of `CFBundleVersion` simply as a build number. – user2067021 Sep 29 '17 at 06:11
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".

Arjun
  • 63
  • 1
  • 30
    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. – Christian Specht Sep 08 '11 at 11:42
  • 2
    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. – Lucien May 04 '12 at 12:21
  • 1
    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' – brian.clear Sep 18 '12 at 13:29
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

Louie
  • 5,920
  • 5
  • 31
  • 45
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

GilesDMiddleton
  • 2,279
  • 22
  • 31