如何强制Flutter更新我的版本和内部版本号?

时间:2020-05-20 21:04:27

标签: xcode flutter deployment command-line-interface

  1. 我已将pubspec.yaml中的版本从1.0.0 + 3更改为1.0.1 + 1
  2. flutter clean
  3. flutter build ios
  4. 当我打开[project] /ios/Runner.xcworkspace时,它仍然显示1.0.0版本。

我在做什么错?如何强制Xcode从CLI或pubspec.yaml更新我的版本?

这是我的Info.plist的样子:

<?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>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>Name</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Sundee</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

3 个答案:

答案 0 :(得分:6)

我明白了。这是因为我在Info.plist中的行看起来不是这样:

<key>CFBundleShortVersionString</key> <string>$(FLUTTER_BUILD_NAME)</string> <key>CFBundleVersion</key> <string>$(FLUTTER_BUILD_NUMBER)</string>

有人知道我为什么有$(MARKETING_VERSION)$(CURRENT_PROJECT_VERSION)吗?

答案 1 :(得分:5)

同样的事情发生在我身上。

我认为当我使用 xcode 接口时他更改了文件 ios/Runner.xcodeproj/project.pbxproj 并且他没有自动获取值

我是这样解决的。

改变这个:

<块引用>

CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version

到:

<块引用>

CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";

这出现了 3 次

答案 2 :(得分:0)

您还需要获取软件包。

CFBundleShortVersionString 是版本的公共“名称”(例如:“ 2.5”或“ 3.8.1”)。您必须在每个版本中增加它。

CFBundleVersion 是私有内部版本号。在AppStore上看不到它。您必须在每次上传时增加它。这意味着,如果您曾经在二进制文件在线之前拒绝了它,并且想要上传一个新的二进制文件,它将具有相同的

CFBundleShortVersionString,但必须具有更高的CFBundleVersion(例如:public“ 2.5”,private“ 2.5”,然后二进制拒绝,然后重新上传私有“ 2.5.1”)