Fix: Blank Version Field in Xcode

Written by

in

Quick answer: Set Version to your app’s release number, such as 3.4.0, and set Build to a separate build identifier, such as 500, in the app target’s General settings. The fields correspond to CFBundleShortVersionString and CFBundleVersion; an older project may have a value in the latter without a value in the former.

Why this happens

Xcode’s Version and Build fields represent two different properties in an app’s information property list. Version is the release number, stored under CFBundleShortVersionString. Build identifies a particular build of that release, stored under CFBundleVersion.

In the older project described in the source, 3.4.0 appeared in Build after an upgrade while Version was blank. The older and newer Xcode interfaces presented these fields differently, so a project can have a value under the build key without a corresponding value under the version key. The field alone does not establish exactly how a particular project ended up that way; inspect the target’s settings and property list before changing it.

The distinction still matters in current projects. A release such as 3.4.0 can have multiple builds—for example, 500 and 501—while testers review successive candidates. The version describes the release; the build distinguishes the individual candidates.

How to fix it

1. Set Version and Build on the app target

  1. Open the project in Xcode and select the project in the navigator.
  2. Under Targets, select your app target, rather than a test or extension target.
  3. Open the General tab and find the Identity section.
  4. Enter the intended release number in Version, for example 3.4.0.
  5. Enter a separate build number in Build, for example 500.
  6. Build the app and verify the resulting values before distributing it.

If 3.4.0 is currently in Build and it was meant to be your release number, put it in Version. Choose the Build value based on your existing distribution history; don’t assume an arbitrary example like 500 is suitable for an app that already has uploaded builds.

For App Store Connect uploads, use a build number that distinguishes the new build from builds already uploaded for the same version. Keeping build numbers increasing is a simple way to avoid confusion.

2. Check the underlying property-list keys

If the fields are still blank or the resulting app reports unexpected values, check which keys the target is using:

Xcode value Property-list key Example
Version CFBundleShortVersionString 3.4.0
Build CFBundleVersion 500

Select the app target and open its Info tab. Xcode may show descriptive names instead of the raw keys: Bundle versions string, short for Version and Bundle version for Build. In the property-list editor, use Show Raw Keys/Values from the contextual menu if you need to see the key names.

For a project with an explicit Info.plist, inspect that file as well. If the version key is missing, add it or configure the target so the built app receives the correct value. Don’t add a second copy of a key that already exists. Also check the relevant build configuration: Debug and Release can have different settings, so a value that looks right when running locally may not match an archive.

3. Check build settings and substitutions

Some projects put values directly in an Info.plist; others use build settings and substitutions. In the app target’s Build Settings, search for Marketing Version and Current Project Version. These correspond to the MARKETING_VERSION and CURRENT_PROJECT_VERSION build settings.

For example, an explicit property list may use these references instead of hard-coded numbers:

<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>

In that arrangement, set the actual values in the target’s build settings. If the plist contains a literal value instead, changing a separate build setting may not change what that plist entry supplies. Generated property lists are another reason to verify the finished app rather than relying on a source file alone.

Avoid changing both a hard-coded plist value and a build-setting substitution without first understanding which one the target uses. The goal is one clear source for each value.

4. Verify the values in the built app

The most useful check is the Info.plist inside the app you intend to distribute. In Terminal, substitute the path to your built app for the example path:

plutil -p "/path/to/YourApp.app/Info.plist"

Look for CFBundleShortVersionString and CFBundleVersion in the output. Confirm that they contain the intended release and build numbers, not an empty value or an unresolved substitution. For an archive, inspect the app inside the archive you plan to distribute, since it may have been built with a different configuration from your local run.

You can also display the values from Swift when diagnosing an app at runtime:

import Foundation

func appVersionDescription() -> String {
    let info = Bundle.main.infoDictionary
    let version = info?["CFBundleShortVersionString"] as? String ?? "Unknown"
    let build = info?["CFBundleVersion"] as? String ?? "Unknown"
    return "\(version) (\(build))"
}

For the example values, this returns 3.4.0 (500). Unknown means the corresponding value wasn’t available as a string in the main bundle; it should prompt a check of the built app’s property list.

How to prevent it

  • Keep Version for the release number and Build for the individual build identifier.
  • Check your existing App Store Connect build history before choosing a number for an upload.
  • Make version settings consistent across the configurations you use for testing and archiving.
  • Verify the values in the finished app after migrating an older project or changing its plist setup.
  • Document whether your project sets these values directly or through build-setting substitutions.

FAQ

Can Version and Build have the same value?

They are separate properties, even if their text happens to match. Using a release number such as 3.4.0 for Version and a distinct build number such as 500 makes successive builds easier to identify.

Do I need to increase Version for every test build?

No. You can keep the same release version while producing successive builds of that release. Use a different build number when uploading another build for the same version.

Why does Swift show Unknown for the version?

In the example above, Unknown is a fallback when the requested key is missing or isn’t available as a string. Check the built app’s Info.plist and confirm that you’re reading the main app bundle.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.