How to force Flutter to update my version and build number?

3,892

Solution 1

I got it. It's because my lines in my Info.plist did not look like the following:

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

Anyone has an idea why I had $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION)?

Solution 2

The same thing happened to me.

I think that when I used the xcode interface he changed the file ios/Runner.xcodeproj/project.pbxproj and he didn't get the value automatically

I solved it like this.

change this:

CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version

to:

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

this appears 3 times

Share:
3,892
Tomas Baran
Author by

Tomas Baran

Updated on December 20, 2022

Comments

  • Tomas Baran
    Tomas Baran over 1 year
    1. I've changed my version in pubspec.yaml to 1.0.1+1 (from 1.0.0+3)
    2. flutter clean
    3. flutter build ios
    4. When I open [project]/ios/Runner.xcworkspace it still shows me 1.0.0 version.

    What am I doing wrong? How can I force Xcode to update my version from CLI or pubspec.yaml?

    This is how my Info.plist looks like:

    <?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>
    
  • Cihad Turhan
    Cihad Turhan almost 4 years
    Thanks, I was wondering that too. I used flutter to create project but I used an older version of flutter cli in the beginning. This could be the problem. However, there is another problem that it doesn't increase build version when I update pubspec.yml and run packages get. Any idea?
  • Tomas Baran
    Tomas Baran almost 4 years
    No idea. I know that Xcode can automatically increase the build number but didn't know that Flutter was able to do the same thing.
  • Tomas Baran
    Tomas Baran almost 4 years
    Actually it looks like they are not planning on allowing the auto-increase of build number: github.com/flutter/flutter/issues/41955
  • Matthew Sisinni
    Matthew Sisinni about 2 years
    $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION) get added by XCode when you change "Version" and "Build" under Targets -> General -> Identity
  • fräfrö
    fräfrö about 2 years
    After trying all different things (including plist changes), this did the trick for me. Thanks!
  • Mark
    Mark almost 2 years
    This is the correct answer and should be marked as correct. The problem occurs when you manually change the build number inside Xcode. This solution will then correct the problem