Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: if MARKETING_VERSION or CURRENT_PROJECT_VERSION is overridden in Xcode project, pubspec version is ignored #2629

Open
bryanoltman opened this issue Nov 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bryanoltman
Copy link
Contributor

Description

Xcode project files contain the MARKETING_VERSION and CURRENT_PROJECT_VERSION variables that override the version and build number, respectively, in the Info.plist (and, by extension, the pubspec.yaml).

These are set by typing version and build number into Xcode directly:
Screenshot 2024-11-19 at 11 26 03 AM

and are reflected in the project.pbxproj file:

		DC2A3CFD2A7819C70077C0D3 /* Release-stable */ = {
			isa = XCBuildConfiguration;
			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CLANG_ENABLE_MODULES = YES;
				CURRENT_PROJECT_VERSION = 444;
				DEVELOPMENT_TEAM = 6V53YACS2W;
				DISPLAY_NAME = "Shorebird Example";
				ENABLE_BITCODE = NO;
				INFOPLIST_FILE = Runner/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
				);
				MARKETING_VERSION = 1.2.3;
				PRODUCT_BUNDLE_IDENTIFIER = com.example.flavors;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
				SWIFT_VERSION = 5.0;
				VERSIONING_SYSTEM = "apple-generic";
			};
			name = "Release-stable";
		};

This is usually not what a user wants, so we should probably introduce an iOS validator to check whether these are set and warn the user that the app version in their Info.plist/pubspec.yaml will not be applied and give them steps re: how to fix.

Steps to fix:

  1. Go to your Runner (or whatever you've renamed your app to) target in Xcode
  2. Click on Build Settings
  3. Select "All" and "Levels"
    Screenshot 2024-11-19 at 11 28 25 AM
  4. Search for MARKETING_VERSION
  5. Select the green rectangle and delete it
    Screenshot 2024-11-19 at 11 29 04 AM
  6. Do steps 4 and 5 for CURRENT_PROJECT_VERSION
@bryanoltman bryanoltman added the bug Something isn't working label Nov 19, 2024
@bryanoltman
Copy link
Contributor Author

The cause of this problem in the Discord thread that spawned this issue was that FLUTTER_BUILD_NUMBER and FLUTTER_BUILD_NAME were set as user-defined values in Xcode.
Screenshot_2024-11-19_at_10 50 26_PM

@bryanoltman bryanoltman changed the title fix: if MARKETING_VERSION or CURRENT_PROJECT_VERSION is set in Xcode project, pubspec version is ignored fix: if MARKETING_VERSION or CURRENT_PROJECT_VERSION is overridden in Xcode project, pubspec version is ignored Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant