Easily Keep Build Numbers And Marketing Versions In Sync
Let’s take a look at how to change all of your targets’ build numbers and marketing versions in a single place. I was surprised to find that a lot of developers don’t know this simple trick & manually change their build numbers and marketing versions in 5 or more targets with every release. It’s time to end this madness & define a single source of truth!
Make sure that the project's Current Project Version and Marketing Version are set. This will be the single source of truth for your build number and marketing version. Find these settings by clicking the project in the navigator, clicking the project (above the targets), and typing "versioning" into the filter.
Sync Build Number / Project Version (e.g. 123) in each target
In your targets, go to the Build Settings tab and set Current Project Version to $(CURRENT_PROJECT_VERSION)
Also update any .plist files that contain a Bundle version entry (also called CFBundleVersion), setting Bundle version to $(CURRENT_PROJECT_VERSION)
Sync Marketing Version (e.g. 1.2.3) in each target
In your targets, go to the Build Settings tab and set Marketing Version to $(MARKETING_VERSION)
Also update any .plist that contain Bundle version string (short) (also called CFBundleShortVersionString), setting Bundle version string (short) to $(MARKETING_VERSION)
That’s it! From here on out you will only need to change the build number and marketing version in your project settings, and all targets will inherit that value.
I hope this was helpful - see you next time!