Xcode 14 and missing sync with CFBundleVersion edit in Info.plist during Build/Archive
Asked Answered
M

2

11

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 Target's General Tab

This is Target's Info TabTarget's Info Tab

This is Info.plist file correctly updated by Build Phase ScriptInfo.plist file

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.

Morsel answered 30/9, 2022 at 8:46 Comment(3)
Did you find a solution? I have the very same problemBurgh
Nope, sorry. Still changing "numbers" by hand.Morsel
I met the same issue.Expeditious
W
1

I use xcconfig for set version and build in Xcode. In Base.xcconfig set

MARKETING_VERSION = 22.47.0
CURRENT_PROJECT_VERSION = 221125.1437

Pay attention if you using CocoaPods you should create Release and Debug xcconfig with content Debug.xcconfig

#include "../Pods/Target Support Files/Pods-{SET_PROJECT_HERE}/Pods-{SET_PROJECT_HERE}.debug.xcconfig"
#include "Base.xcconfig"

Release.xcconfig

#include "../Pods/Target Support Files/Pods-{SET_PROJECT_HERE}/Pods-{SET_PROJECT_HERE}.release.xcconfig"
#include "Base.xcconfig"

Set values in info.plist

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

Hope its help

Wapentake answered 9/12, 2022 at 15:49 Comment(0)
S
1

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

#!/bin/bash

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!

Spotweld answered 21/2, 2023 at 10:52 Comment(1)
I am using similar versioning script, but recently the Build (number) in the Xcode targets - General tab is not showing the correct CFBundleVersion variable. The script is still working and the info.plist file is changing as before, but the Build in the General tab is not changing. It seems it is using the Build setting Current project version data now, but it is not reflected in the info.plist file.Crabwise

© 2022 - 2024 — McMap. All rights reserved.