16
  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>
Tomas Baran
  • 1,570
  • 2
  • 20
  • 37

6 Answers6

40

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

Elvis Teles
  • 738
  • 6
  • 9
  • 4
    After trying all different things (including plist changes), this did the trick for me. Thanks! – fräfrö Feb 25 '22 at 09:15
  • 3
    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 – Mark May 01 '22 at 01:59
  • for my project, i also needed to make same changes in info.plist: CFBundleShortVersionString $(FLUTTER_BUILD_NAME) CFBundleVersion $(FLUTTER_BUILD_NUMBER) – tmr Jan 30 '23 at 09:05
32

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)?

Tomas Baran
  • 1,570
  • 2
  • 20
  • 37
  • 1
    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? – Cihad Turhan May 21 '20 at 23:54
  • 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 May 23 '20 at 12:34
  • Actually it looks like they are not planning on allowing the auto-increase of build number: https://github.com/flutter/flutter/issues/41955 – Tomas Baran May 23 '20 at 19:41
  • 2
    $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION) get added by XCode when you change "Version" and "Build" under Targets -> General -> Identity – Matthew Sisinni Feb 02 '22 at 02:04
1

In my case, I had different flavors for my app, which I kind of understand to be schemes in XCode.

After doing flutter clean, since my app was done almost a year ago, I also decided to remove the android and ios folders to start from scratch, even the custom configurations. After that, I did pod install by setting my configurations to None first.

And then I encountered the issue. I did all the above solutions but didn't really work.

Turns out doing pod install set the Runner targets' build configs to Pods-Runner.<flavor>. I was able to have it update again after setting it to the Generated.xcconfig file.

before

after

I decided to set the Project config to the generated Pods-Runner.<flavor>, though I'm still not quite sure why, just felt like it was generated for a reason. Anyone who could help would be greatly appreciated.

Louise
  • 31
  • 4
1

@louise's answer got me pretty close but, weirdly, mine was the exact opposite. My Configurations look like this:

enter image description here

hugo
  • 1,175
  • 1
  • 11
  • 25
0

You need also get package.

CFBundleShortVersionString is the public "name" of the version (example: "2.5", or "3.8.1"). You must increase it at each release.

CFBundleVersion is the private build number. It is not seen on the AppStore. You must increase it at each upload. It means that if you ever reject a binary before it goes online, and you want to upload a new binary, it will have the same

CFBundleShortVersionString but must have a higher CFBundleVersion (example: public "2.5", private "2.5", and then binary reject, and re-upload private "2.5.1")

Yousif khalid
  • 5,801
  • 3
  • 18
  • 23
0

To achieve this, you have to add some values in CfBundleVersionShortString

Like:

   <key>CFBundleShortVersionString</key>
   <string>1.0</string> 

And give the build value in Runner as 1.0 and version as 1.0

screenshot

Dani3le_
  • 1,257
  • 1
  • 13
  • 22