Every upload to App Store Connect needs a build number higher than the one before it. Our cloud pipeline kept producing a package whose build number was 1, no matter what we changed. It took three attempts to find out why. This is the story and the fix, for anyone who builds iOS apps from a generated Xcode project without a Mac of their own.
The symptom
The upload step failed with an error saying the bundle version must be higher than the previously uploaded one. The first upload of an app always works, so the problem only shows from the second build on. The number shown for the build on the store side was 1 every time.
Two numbers are involved. The marketing version, such as 1.0, is what people see. The build number, CFBundleVersion, only has to increase with every upload of the same marketing version.
Attempt one: archive flags
The build tool has a way of passing extra flags to the archive command, so we passed the build number there. Nothing changed.…