agvtool doesn't update extension Marketing Version

We have a bit of a complicated build process and need to build the Widget outside of our main app and repackage since we are using a cross platform framework. I tried scripting out updating my Widget's Marketing Version but agvtool won't update the MARKETING_VERSION in the project.pbxproj file. Therefore, we end up getting these emails from Apple:

ITMS-90473: CFBundleShortVersionString Mismatch - The CFBundleShortVersionString value ‘1.2.2’ of extension ‘MyiOSApp.app/PlugIns/widgetExtension.appex' does not match the CFBundleShortVersionString value ‘1.2.3' of its containing iOS application ‘MyiOSApp.app'.

I run this and it says it's updating in the Widget plist (but not the project.pbxproj) so when I build with xcode via command line it doesn't update and when we submit to the App Store we get the above message from Apple:

/usr/bin/agvtool new-marketing-version $(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ../My.Crossplatform.App/My.Crossplatform.App.iOS/Info.plist)
Setting CFBundleShortVersionString of project ios to: 
  1.2.3.

Updating CFBundleShortVersionString in Info.plist(s)...

Cannot find "ios.xcodeproj/../YES"
Updated CFBundleShortVersionString in "ios.xcodeproj/../widget/Info.plist" to 1.2.3

I've had to resort to manually updating then submitting every time. What is the correct way to update the MARKETING_VERSION in the project.pbxproj file in a CI environment using bash?

Hi. Have you figured this ../YES thing out?

Haha... asked and then remembered --- need to set GENERATE_INFOPLIST_FILE to NO in order for this to work.

Check this thread on using build configuration files to externalise versions for easier updating by your own scripts: https://developer.apple.com/forums/thread/709065?answerId=718911022#718911022

This actually needs to be a BUG REPORT.

The agvtool tool fails when the key GENERATE_INFOPLIST_FILE is present. I assume that the agvtool tool is looking for the key INFOPLIST_FILE, but isn't coded correctly to exclude a result of INFOPLIST_FILE being prefixed with GENERATE_, so it tries to find the location of the Info.plist file using GENERATE_INFOPLIST_FILE value of YES. Which FAILS.

If a dev wants to add custom fields to Info.plist, then an Info.plist is still written to disk at the location specified by INFOPLIST_FILE.

Cheers.

Did anyone figure out how to solve this? I am also getting this Cannot find "MyApp.xcodeproj/../YES" error from agvtool (Xcode 15):

$ xcrun agvtool next-version -all
Setting version of project MyApp to:
    3.

Also setting CFBundleVersion key (assuming it exists)

Updating CFBundleVersion in Info.plist(s)...

Cannot find "MyApp.xcodeproj/../YES"

I was able to resolve this by:

  1. Adding an Info.plist file containing CFBundleVersion and CFBundleShortVersionString keys
  2. Adding INFOPLIST_FILE = <Path to Info.plist> to project.pbxproj
  3. Deleting GENERATE_INFOPLIST_FILE entirely from project.pbxproj

In addition to getting rid of the "Cannot find" message, this was the only way I was able to get marketing versions to work. xcrun agvtool new-marketing-version <version> appears to be a no-op when using GENERATE_INFOPLIST_FILE.

Here's a minimal example Info.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleVersion</key>
	<string>1.0</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
</dict>
</plist>

Those two values will be altered by xcrun agvtool new-version -all <version> and xcrun agvtool new-marketing-version <version>, respectively.

One important note: Anything specified with INFOPLIST_KEY_ in your project.pbxproj will no longer apply once you've opted out of GENERATE_INFOPLIST_FILE. You'll need to move those values into your new Info.plist file. For example, if you use INFOPLIST_KEY_LSUIElement = YES, you'll need to add <key>LSUIElement</key><true/> to your Info.plist.

If I were Apple, I'd modify xcrun agvtool to 1) check if GENERATE_INFOPLIST_FILE = YES and 2) if so, insert e.g. INFOPLIST_KEY_CFBundleVersion = <version> into project.pbxproj instead of trying to modify Info.plist.

agvtool doesn't update extension Marketing Version
 
 
Q