使用CodeMagic部署时如何增加Flutter IOS应用程序的内部版本号

问题描述 投票:3回答:2

当我使用Nevercode拥有的CodeMagic(https://codemagic.io/)部署Flutter应用程序时,我无法自动增加我的Flutter应用程序的内部版本号。

我按照本页描述的步骤操作:https://developer.nevercode.io/docs/incrementing-ios-app-version

他们建议的脚本如下:

DSYM_INFO_PLIST="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
buildNumber=$NEVERCODE_BUILD_NUMBER
stringLength=${#buildNumber}

if [ $stringLength -ne 0 ]; then
    echo "Updating build number to $buildNumber"
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
    if [ -f "$DSYM_INFO_PLIST" ]; then
        /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NUMBER" "$DSYM_INFO_PLIST"
    fi
else
    echo "Missing build number, skip updating"
fi

我在Xcode中添加此脚本后,出现此错误:

Running pod install...                                             34.3s
Running Xcode build...
 ├─Assembling Flutter resources...                           6.1s
 └─Compiling, linking and signing...                         6.9s
Xcode build done.                                           30.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    /Users/macbook/Library/Developer/Xcode/DerivedData/Runner-hdgyskbygbvchfagqudvhwidlraa/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-3590602C2
    2484D000061C91A.sh: line 15: syntax error: unexpected end of file
    Command /bin/sh failed with exit code 2

Could not build the precompiled application for the device.

有人可以说明如何在部署Codemagic时正确增加IOS应用程序的内部版本号吗?它应该是在Xcode的构建阶段中运行的脚本还是在Codemagic工作流的构建步骤中添加的命令?

理想情况下,每当我使用flutter run运行应用程序时,它都不会增加,但是当我将它部署到App Store Connect时。

ios flutter continuous-integration app-store build-numbers
2个回答
3
投票

现在,我写信给Codemagic.io。这是回应:

我们提供$ BUILD_NUMBER变量来将其用于版本控制。例如,您可以使用像--build-name="1.0.$(($BUILD_NUMBER + 100))" --build-number=$(($BUILD_NUMBER + 100))这样的构建参数


1
投票

有更多选项可以使用$ BUILD_NUMBER变量进行构建版本控制。您可以在Codemagic文档中找到一些示例:https://docs.codemagic.io/building/build-versioning/

© www.soinside.com 2019 - 2024. All rights reserved.