In my iOS apps, i have a script (a build phase actually) that upgrades the target’s Info.plist CFBundleVersion to a number related to the git commit count. I’ve been using for a while and it works for me, never a problem.
On Xcode 14, something has changed and the script keeps working (i mean the .plist file is correctly updated) but applications no longer shows the correct build number and it’s missing on Archive too.
I’ll add some screenshot (of a blank new project, so no settings have been altered in times).
This is Target’s General Tab in Xcode 14
This is Info.plist file correctly updated by Build Phase Script
In previous Xcode versions, on Target’s General Tab i used to have the build number synced with the one in .plist file and it was also synced when Archiving builds.
Now, if i try to archive the build, it goes out as 1.0(1).
Am I missing something or am I doing something wrong?
Hope you can understand my English.
Thanks for your help.
2
Answers
I use xcconfig for set version and build in Xcode.
In Base.xcconfig set
Pay attention if you using CocoaPods you should create Release and Debug xcconfig with content
Debug.xcconfig
Release.xcconfig
Set values in info.plist
Hope its help
Feb 20th, 2023, my temporary solution:
step 0: delete the system generated info.plist
step 1: move all settings to your plist file as you did years ago and rename it to any+info.plist
step 2: after adding your any+info.plist file to project, delete it from ‘Build phase copy bundle’
step 3: search build setting and make ALL "Generate info.plist" to NO
step 4: search ‘Infor.plist File’ and give the correct file path of you file
step 5: use this run script
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
step 6: leave a real number in your plist as the bundle version e.g.100
step 7: clean build folder, restart Xcode 14, and build the project
Good Luck!