I don’t know about your first experience uploading to the iTunes store, but if it was anything like mine it was wraught with periles, errors, many tears, and most likely an expletive or seven. One of those errors is the CFBundleVersion error that can show up when you’re updating one of your binaries. This post seeks to tackle that error by showing you:
- How you’ll find out about the error.
- How to determine your current bundle version number.
- How to determine your previous bundle version number.
- How to fix your bundle version number.
How you’ll find out about the error
If you haven’t hit this error yet, you’ll get notified when uploading your binary using the Apple Application Uploader and the error is going to look like this:
This bundle is invalid. The key CFBundleVersion in the Info.plist file must contain a higher version than that of the previously uploaded version.
How to determine your Current Bundle Version number
There are two places in XCode where you can find and set your current bundle version. The first is in the Info.plist file. Here you’re looking for the Key Bundle version. In the image below, the Bundle version is 1.1:
The second place to determine the current bundle version is in the main project area.
By clicking on the main project, then on the target that you’re building, and then the Summary tab you’ll get to the area where the Bundle version resides. The interesting part of this is that it isn’t called Bundle Version – instead it’s called Build. The value here, and the value in the plist will synchronize with each other, so you only need to set the bundle version in one of those locations.
How to Determine your Previous Bundle Version number
The next important step is to figure out what the previous bundle version is. I hit an issue where I was unknowingly incrementing the bundle version and accidentally submitted a bundle version of 10.0. The CFBundleVersion error kept occurring but I had no idea why. Eventually I found out what the previous bundle version was and the problem was then easily solved! So let’s do that now.
Load up iTunes Connect and click on Manage Your Applications. That’s going to take you to your app selection screen. Click on the app that you’re having troubles with. That’s going to load your app information. Click on the View Details link for the Current Version of your app.
That’s going to take you to the app details page. On the right hand side of the screen you’re going to see the link Binary Details under the Links area. Click that.
This page has all the binary details for the current version that you submitted to the app store. And one of the fields is Bundle Version. This is the value that you have to go higher than!
At this juncture it is more than appropriate to bring out the facepalm. I know I did.
How to fix your Bundle Version number
Now a lot of people have trouble with understanding how Apple does version numbering. And there’s one assumption in their system that most people miss: Versioning isn’t done using floating point numbers.
You see, if you submit an app with bundle version 1.21; and then submit a bundle version of 1.3 you’re going to get rejected with the CFBundleVersion error. Go ahead scratch your head. Isn’t 1.21 < 1.3? Yep it is when you’re dealing with decimals. But that’s not how Apple is doing it. Instead this is how Apple is looking at your version numbering:
1 <= 1 ? True 21 < 3 ? False
Apple’s version numbering splits on the decimal point and compares each token. Really the best way to understand version numbering is to think of it as two fields separated by a period: Major.Minor Instead of a single field with a decimal point.
If none of the above suggestions didn’t help you and you’re still facing the issue. Submit a comment and we can work it through together – if it’s an issue I haven’t experienced before I’ll add it to the post too!