45

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

5 Answers 5

77

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

3
  • 1
    This worked for me, thank you! XCode 15, Flutter >=3.10.0 Commented Nov 15, 2023 at 22:43
  • flutter build ipa also works! Commented Feb 18 at 2:11
  • 1
    Only problem with this solution is it takes too long to get the archive. Commented Mar 27 at 11:33
45

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


2
  • 1
    this solved my issue, i didn't have to run 'flutter build ios'
    – Salar Azad
    Commented Jan 18 at 11:13
  • 1
    solution/worked Commented Feb 8 at 22:12
13

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)

2
  • Thanks, worked for me as well! It's even easier if you do the same through Xcode: Go to Runner. Select Runner in "Targets" section below. Then open the Build Settings Tab and Scroll down to Versioning. Edit your Version under "Marketing Version" and Xcode will update all lines for you. Commented Oct 19, 2023 at 12:05
  • Good to know, I'm still not really familiar with xcode.
    – rekire
    Commented Oct 20, 2023 at 6:10
5

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

  • CFBundleShortVersionString
  • CFBundleVersion

then adding this

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

<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
-2

Replace these lines in your info.plist file.

<key>CFBundleShortVersionString</key>
<string>7</string>
<key>CFBundleVersion</key>
<string>1.0.6</string>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.