How to read current app version in Xcode 11 with script

前端 未结 9 1751
野趣味
野趣味 2020-12-14 00:38

Until Xcode 11, I used a script that reads the current app version (for the AppStore) and help me change the LaunchScreen since we can\'t use swift for that

9条回答
  •  温柔的废话
    2020-12-14 01:26

    I'm developing a framework with this scenario:

    • A workspace
    • A framework target
    • An aggregate target with 2 external scripts:
      • one for build a fat framework
      • other for prepare the release framework

    The key is that in XCode 11 the aggregate framework script doesn't get run environment variables for other workspace targets so it's impossible to read the $MARKETING_VERSION from my framework target.

    So the solution that works for me has been use PlistBuddy specifying the Info.plist result of the framework target build in this way:

    FAT_FRAMEWORK="${SRCROOT}/build/${FRAMEWORK_NAME}.framework"
    BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${FAT_FRAMEWORK}/Info.plist")
    VERSION_NUMBER=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${FAT_FRAMEWORK}/Info.plist")
    

提交回复
热议问题