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
Author by
Tomas Baran
Updated on December 20, 2022Comments
-
Tomas Baran over 1 year
- I've changed my version in pubspec.yaml to 1.0.1+1 (from 1.0.0+3)
flutter clean
flutter build ios
- 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 almost 4 yearsThanks, 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 almost 4 yearsNo 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 almost 4 yearsActually it looks like they are not planning on allowing the auto-increase of build number: github.com/flutter/flutter/issues/41955
-
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ö about 2 yearsAfter trying all different things (including plist changes), this did the trick for me. Thanks!
-
Mark almost 2 yearsThis 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