Search code examples
iosscriptingversioningxcode11settings.bundle

Settings.bundle version number is updating as $(MARKETING_VERSION)


I have an app which was setting versions automatically when I incremented from

XCode > General > Version.

But recently I have updated XCode to 11.0 and seems the script is not working as expected:

version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $SRCROOT/MyApp/Info.plist`
version+=" ("
version+=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $SRCROOT/MyApp/Info.plist`
version+=")"
/usr/libexec/PlistBuddy "$SRCROOT/MyApp/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"

Above script suppose to automatically update version and would have been visible in Settings > App.

enter image description here

But the question is there any change need to be done for this script to make automatically update version number from XCode?

Currently it is being replaced by scripts as $(MARKETING_VERSION) when version is incremented from XCode > General > Version which is not correct.


Solution

  • It worked by displaying MARKETING_VERSION itself: Thanks @dgimb and @Mojtaba Hosseini for your answers.

    version="$MARKETING_VERSION"
    version+=" ("
    version+=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $SRCROOT/MyApp/Info.plist`
    version+=")"
    
    /usr/libexec/PlistBuddy "$SRCROOT/MyApp/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"