Xcode Cloud "The bundle version must be higher than the previously uploaded version."

I am getting an error on Xcode Build

The bundle version must be higher than the previously uploaded version.

I am at a loss. My bundle version is set at 20. The latest version uploaded has bundle version 18. The project is clearly higher than the most recently uploaded version.

What am I doing wrong?

I tried setting the Bundle version in both the General tab for the target, in the Build Settings and in the Info.plist. Which takes precedence?

Fastlane reports the current build version as 18 on TestFlight.

Confusingly, throughout Xcode, Bundle Version is variously referred to as both 'Bundle Version' and 'Current Project Version', and is 'Build' on App Store Connect.

App Store Version is variously referred to as 'Version', 'Bundle version string (Short)', and 'Marketing Version'.

Replies

Is it really during Build or during Archiving ?

Where is the identity window ?

Maybe the problem is version. Try with 4.0.1

Apologies, I meant 'Xcode Cloud' in the Archiving stage:

The Identity screen is under the 'General' tab in the Target.

The current release version in ASC is 3.0.1. As you can see from the Fastlane screenshot above, the current TestFlight version is 4.0.0. It should allow me to upload a build with number 20.

So looks like there's an internal error, according to the more verbose logs.

However, weirdly I managed to build and upload it manually with the build number of 19, and this is now finally showing up.

I figured out the issue. The build number is incorrect, because Xcode Cloud sets it itself, even if you define it yourself. According to this document, it always starts from (1) and increments. So, if you have an existing build in TestFlight (say version 1.0.0) and have previously submitted builds and manually incremented the build number, it might be at, say build (10). Then when you start your Xcode Cloud builds it just defaults to build (1) and increments from there, failing when it gets to the 'submit to App Store Connect' stage because the build number it's decided on (1) – regardless of what you've set in the project – is lower than the build for the existing version (10).

You can either keep running builds until you get to the build number already in TestFlight 🤨 or bump your version (e.g. to 1.0.1) and App Store Connect resets its expectations for build numbers.

  • You can also navigate to App Store Connect -> Your App -> Xcode Cloud -> Settings -> Build Number and set the next build number.

Add a Comment

I want to manage the build number m myself. I am happy to call an API to set it before I run the Xcode Cloud build. Or setting a flag to tell Xcode Cloud to use my build number!

How do we et around this?