iTunes Connect Build Number Reset iTunes Connect Build Number Reset xcode xcode

iTunes Connect Build Number Reset


In iOS, but NOT macOS, you can reset the Build Number(CFBundleVersion) any time you update the Version Number (CFBundleShortVersionString).

This is something that you need to do in your Xcode project. The version or build numbers are never automatically reset.

Apple Technical Note TN2420, Version Numbers and Build Numbers

iOS:

For iOS apps, build numbers must be unique within each release train, but they do not need to be unique across different release trains. That is to say, for iOS Apps you can use the same build numbers again in different release trains if you want to.

Mac OS:

However, for macOS apps, build numbers must monotonically increase even across different versions. In other words, for macOS apps you cannot use the same build numbers again in different release trains.


The build number is actually not visible for the user so it doesn't actually really matter what you put in there. Apple wants you to increase it, so just put a higher number in there ;) What build number usually is used for is to track your internal 'number' of builds you did. A lot of people use automatic build incrementors for that but more sophisticated companies manage it explicitly.

Since you don't seem to care about the build number, you can just use an automatic script and never look at it again. I use this script:

#!/bin/shplist="$1"dir="$(dirname "$plist")"buildnum=$(/usr/libexec/Plistbuddy -c "Print CFBundleVersion" "$plist")IFS="."save=""out=""for i in $buildnumdo out=$out$savesave="$i."doneA=($save)save=${A[0]}save=`expr $save + 1`save=$(printf "%05d" $save)out=$out$saveIFS="ABVVVV"buildnum=$out/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnum" "$plist"

Copy paste the code into a file with '.sh'-extension on your file system, where you will never delete it (or into your project dir) and then go to your xcode project, on the left select your project name (open the project settings) click on the build target, go to the 'build phases'. Then a new build phase of type 'Run Script'

For 'Shell' insert /bin/shand in the code line below insert

#/bin/sh/Users/..PutThePathToTheScriptYouSavedAboveHere.sh "${PROJECT_DIR}/${INFOPLIST_FILE}"

I am using build versions using X.XX.XXXXX the script will just increase the last number.