Make sure developers have had such trouble:Version submitted wrong!
Version of the compiler and testing more,When the inevitable submitted only to find the wrong version number。Or is the background version number is correct,Reception forget to change the version number。In fact,Allows reception automatically obtain the version number of the background data,For example, this:
1 2 |
let info = Bundle.main.infoDictionary! version.text = "Version \(info["CFBundleShortVersionString"]!) (build \(info["CFBundleVersion"]!))" |
But
Background version still have to manually write ah! It fills the major version number,Different programs have their own different style,This is not a number and some even skipped,Then builds it? Every time to manually change,Or accidentally forget going to spend an hour to re-compile,This is a very boring thing。
In fact, you can make the build number (build) increment:
Add a compiled script in your project: Targets → your target → Build Phases → Run Script
Only you need to change the content of the script as follows:
1 2 3 |
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $PRODUCT_SETTINGS_PATH` version=`expr $version + 1` /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version" $PRODUCT_SETTINGS_PATH |
note,If your project has multiple compile targets - such as the input method had pocketed input method and keyboard plug two main app,Then these two should be added,And you have to be consistent version number of the two projects,So that they would be uniform increments,When submitted no warning。
Original article written by LogStudio:R0uter's Blog » Xcode automatic version
Reproduced Please keep the source and description link:https://www.logcg.com/archives/2539.html
The version number is good yo。。。。