iOS app, programmatically get build version
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
On iOS, the build version and the marketing version are not the same thing. If you want to show version info in a debug screen, attach it to bug reports, or log it at startup, you usually read CFBundleVersion for the build number and CFBundleShortVersionString for the user-facing release version.
Read Version Values From Info.plist
The app bundle exposes its metadata through Bundle.main. The keys you usually want are:
- '
CFBundleVersionfor the build number' - '
CFBundleShortVersionStringfor the release version'
In Swift:
This is the most direct way to access the values that Xcode writes into the app bundle.
Wrap the Logic in a Helper
Instead of scattering string keys around the app, wrap them in a small helper:
This makes it easy to reuse the information in settings screens, support emails, diagnostics, and crash reports.
Show It in SwiftUI or UIKit
For SwiftUI:
For UIKit:
The values are static for the running build, so reading them once and exposing them through a helper is usually enough.
Understand the Difference Between Build and Release Version
Developers often mix these values up:
- '
CFBundleShortVersionStringis what users think of as the app version, such as2.4.1' - '
CFBundleVersionis the internal build number, such as2410'
The App Store expects the build number to increase for each uploaded build of a given release version. That is why support teams often ask for both values rather than only one.
Objective-C Version
If you are maintaining older iOS code, the same data is available in Objective-C:
The source is the same Info.plist; only the syntax changes.
Make It Visible in Diagnostics
Reading the values is only half the job. The real benefit comes when you include them in places where support and engineering can actually see them, such as:
- An in-app debug screen
- Startup logs
- Crash-report metadata
- Support emails generated from the app
That makes it much easier to distinguish "the user is on release 2.3" from "the user is on build 2415 of release 2.3."
Common Pitfalls
- Reading only
CFBundleShortVersionStringwhen you really need the internal build number makes bug reports less precise. - Hardcoding version strings in UI code guarantees they will drift from the actual app metadata.
- Misspelling the
Info.plistkeys returnsnil, so wrap access safely. - Assuming TestFlight, App Store, and local debug builds all share the same versioning behavior can create confusion if the build number is not being incremented properly in Xcode or CI.
Summary
- Use
Bundle.mainto read version metadata fromInfo.plist. - '
CFBundleVersionis the build number;CFBundleShortVersionStringis the release version.' - Wrap the lookup in a helper so the app uses one consistent source of truth.
- Show both values when you need support-friendly diagnostics.

