10

When I archive my iOS app in xCode for uploading to the Apple appstore it stopped gettign the right version number and build number:

enter image description here

My pubspec.yaml has the right numbers:

version: 1.0.9+11

And it looks right in xCode but not once it gets archived:

enter image description here

aligur
  • 3,387
  • 3
  • 34
  • 51
Ten Digit Grid
  • 1,315
  • 4
  • 22
  • 43

4 Answers4

36

I needed to run flutter build ios before opening xcode and running archive. Now the versions numbers are correct.

aligur
  • 3,387
  • 3
  • 34
  • 51
Ten Digit Grid
  • 1,315
  • 4
  • 22
  • 43
14

if you still have this issue after performing the command mentioned in accepted answer you should try to edit info.plist file manually:

use below strings in info.plist:

For CFBundleShortVersionString use --> $(MARKETING_VERSION)

For CFBundleVersion use --> $(CURRENT_PROJECT_VERSION)

this is how i solved that issue. hope it helps.


ps: assuming that you are trying to change it through Xcode


aligur
  • 3,387
  • 3
  • 34
  • 51
2

This is an extension to the answers of aligur and samad shukr. I had to change some more details to make it working again.

You need to change ios/Runner/Info.plist look for the keys CFBundleShortVersionString and CFBundleVersion:

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

And ios/Runner.xcodeproj/project.pbxproj:

There are multiple lines with CURRENT_PROJECT_VERSION = ... all of them has to be replaced with CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; and delete all lines with the fields FLUTTER_BUILD_NUMBER and MARKETING_VERSION (if those are not present you didn't messed that up)

rekire
  • 47,260
  • 30
  • 167
  • 264
0

I have solved this problem by opening info.pilist searching for these two keys and remove

  • CFBundleShortVersionString
  • CFBundleVersion

then adding this

<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>

<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
samad shukr
  • 561
  • 7
  • 15