Reputation: 1500
When I run flutter build run
I expect the version and build number to user my version in pubspec.yaml 1.1.5+10
However the 10 is always reverting to 1. This is set correctly in info.plist
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
But when I open xcode v12.2 it's changing $(FLUTTER_BUILD_NUMBER)
back to
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
Somehow xcode itself is reverting these changes in info.plist.
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[!] Android Studio (version 4.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
Upvotes: 19
Views: 11302
Reputation: 1857
My solution was to go to the file located at this address:
./ios/runner.xcodeproj/project.pbxproj
Once opened the file had the following value defined:
FLUTTER_BUILD_NUMBER = 5
I replaced it with this:
FLUTTER_BUILD_NUMBER = "$(FLUTTER_BUILD_NUMBER)";
I got the version number working in the app using flavors.
Upvotes: 0
Reputation: 497
I have encountered similar problem multiple times. What I did was set Generated configuration for all profiles [PROFILE] (Debug, Release, Profile).
Go to XCode -> Runner -> Project (Runner) -> Info.
On Target level all Runners were using Pods-Runner.[PROFILE]. On Project level there was no configuration used, so I selected Generated for all.
I don't know what are the actual implications of this change, but build version and name are picked up from Generated.xcconfig file now.
Upvotes: 5
Reputation: 4621
This is because Flutter build/run CLI overwrites iOS/Android build version from pubspec.yaml
.
In my case, I use manually build(gym command of fastlane) and build version was same as before.
Use flutter build
for build or you have to manually overwrite the version.
Upvotes: 3
Reputation: 898
It's a problem in the ios/Runner.xcodeproj/project.pbxproj file
I solved with this
update my version and build number
change this:
CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version
to:
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
Upvotes: 28
Reputation: 3077
The information in Xcode will not update just because you update and save pubspc.yaml. You must rebuild for iOS in order for the changes to be reflected in Xcode.
Upvotes: 5