Version, build number and phased release
Two numbers
- Version —
CFBundleShortVersionString, in build settingsMARKETING_VERSION: what the user sees in the App Store, for example2.4.0. Up to three non-negative integers separated by dots. - Build number —
CFBundleVersion, in build settingsCURRENT_PROJECT_VERSION: an internal counter, for example412or2.4.0.412. Every upload to App Store Connect for a version must have a number higher than the previous one; on CI it's taken from the run number.
One version, many builds: 2.4.0 (410) went to TestFlight, a bug was found, 2.4.0 (411) went to review. The user sees only 2.4.0.
let info = Bundle.main.infoDictionary
let version = info?["CFBundleShortVersionString"] as? String ?? "?"
let build = info?["CFBundleVersion"] as? String ?? "?"
print("Version \(version) (\(build))") // on the About screen and in logs
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep