CFBundleVersion
CFBundleShortVersionString
app versioning
iOS development
Xcode configuration

What values should I use for CFBundleVersion and CFBundleShortVersionString?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

When developing an iOS or macOS application, developers must include specific identifiers within the app's Info.plist file, notably `CFBundleVersion` and `CFBundleShortVersionString`. These keys play a critical role in version management, facilitating both internal tracking and user-facing updates. Understanding their requirements and appropriate usage is essential for ensuring accurate and smooth app updates. Let's dive into the details of what values should be used for these keys and explore some best practices.

CFBundleVersion

Definition

`CFBundleVersion` is a mandatory key that typically represents the build number of the app. It's primarily used to distinguish between different builds of the same version of an application. This key is essential for Apple's app and TestFlight distribution processes.

Format

The value of `CFBundleVersion` must be a string comprised of three numbers separated by periods. However, it can also be a single integer.

  • General Structure: `X.Y.Z`, where X, Y, and Z are integers.
  • Example Values: `1`, `1.0`, `3.1.2`

Usage Recommendations

  • Incremental Incrementation: Each app store submission or significant build should increment the `CFBundleVersion`.
  • Continuous Integration: Utilize automatic scripts or CI/CD tools to auto-increment this number with each build, ensuring no duplicate build numbers are submitted accidentally.
  • Internal Use: `CFBundleVersion` helps in quickly locating and identifying issues or testing the exact environment when bugs are reported.

CFBundleShortVersionString

Definition

`CFBundleShortVersionString` is a user-facing value that indicates the release version number of the app. This version appears in the app store and should follow semantic versioning principles to give users a clear understanding of the version history and the scope of changes.

Format

The `CFBundleShortVersionString` should be a string in the format of three non-negative, period-separated integers. Unlike `CFBundleVersion`, full semantic versioning is a requirement here.

  • General Structure: `X.Y.Z`, where X is the major version, Y is the minor version, and Z is the patch version.
  • Example Values: `1.0.0`, `2.3.1`, `10.2.0`

Usage Recommendations

  • Semantic Versioning:
    • Major (X) changes involve significant updates or backward-incompatible alterations.
    • Minor (Y) changes incorporate new features that are backward compatible.
    • Patch (Z) addresses bug fixes and small, backward-compatible improvements.
  • Consistency: Ensure this number follows a sensible sequence and reflects the release's state when compared to previous releases.

Key Differences Between CFBundleVersion and CFBundleShortVersionString

While both serve versioning purposes, they cater to distinct audiences and processes:

AspectCFBundleVersionCFBundleShortVersionString
VisibilityInternal: Developer and store systemsExternal: Users and marketing view
Use CaseBuild identification for uploadsUser-facing versioning and clarity
Incrementing FrequencyEach new internal/external buildMajor/minor/patch update releases
UsabilityUseful for debugging and CI systemsSemantic clarity for user updates
Format RequirementNumber or X.Y.ZX.Y.Z

Additional Technical Considerations

  • App Review Process: Ensure both values are present and correctly formatted to avoid rejection during Apple's review process.
  • Backward Compatibility: If utilizing versioning schemes (especially for `CFBundleShortVersionString`), consider how older versions interact with services or APIs expecting specific behaviors.
  • Automation: Using scripts or build pipelines to manage value increments optimizes efficiency and reduces human error.

Practical Examples

Below is an example of how these values can be set within an `Info.plist` file:


Course illustration
Course illustration

All Rights Reserved.