Flutter iOS app version and build number not updating when Archiving in xCode
Asked Answered
T

5

41

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

Thallus answered 15/10, 2022 at 21:4 Comment(0)
T
74

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

Thallus answered 8/11, 2022 at 4:18 Comment(3)
This worked for me, thank you! XCode 15, Flutter >=3.10.0Sensorium
flutter build ipa also works!Mclain
Only problem with this solution is it takes too long to get the archive.Rozek
J
42

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


Jaco answered 20/4, 2023 at 23:13 Comment(2)
this solved my issue, i didn't have to run 'flutter build ios'Starwort
solution/workedViipuri
L
12

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)

Lara answered 6/8, 2023 at 13:39 Comment(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.Foreandaft
Good to know, I'm still not really familiar with xcode.Lara
P
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>
Providing answered 22/6, 2023 at 9:39 Comment(0)
A
-2

Replace these lines in your info.plist file.

<key>CFBundleShortVersionString</key>
<string>7</string>
<key>CFBundleVersion</key>
<string>1.0.6</string>
Amadaamadas answered 8/5 at 12:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.