18

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

4 Answers 4

46

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

1
  • This worked for me, thank you! XCode 15, Flutter >=3.10.0 Nov 15 at 22:43
22

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


1
  • 1
    this works for me. Thanks.
    – khatzie
    Aug 11 at 5:27
5

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. Oct 19 at 12:05
  • Good to know, I'm still not really familiar with xcode.
    – rekire
    Oct 20 at 6:10
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>

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

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