首页 > 解决方案 > 如何强制 Flutter 更新我的版本和内部版本号?

问题描述

  1. 我已将 pubspec.yaml 中的版本更改为 1.0.1+1(从 1.0.0+3)
  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>

标签: xcodeflutterdeploymentcommand-line-interface

解决方案


我知道了。这是因为我在 my 中的行Info.plist看起来不像以下内容:

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

任何人都知道为什么我有$(MARKETING_VERSION)and $(CURRENT_PROJECT_VERSION)


推荐阅读