I have created multiple environments(Development, QA, Production) in my flutter app using flavors and it works fine. To differentiate each environments, I have created different AppIcons for each. When I run in iOS simulator it install with right AppIcon, but after distributing the App Store using 'Codemagic' it picks wrong icon 'AppIcon'(Default), it should be 'ProductionAppIcon'.
In Codemagic.yamal file:
environment:
vars:
XCODE_WORKSPACE: "$FCI_BUILD_DIR/ios/Runner.xcworkspace"
XCODE_SCHEME: "Runner"
- app-store-connect fetch-signing-files "$BUNDLE_ID" --type IOS_APP_STORE --create
- keychain add-certificates
- xcode-project use-profiles
- flutter build ipa -t lib/src/main_prod.dart — flavor Production --release
- name: Build ipa for distribution
script: xcode-project build-ipa --workspace "$XCODE_WORKSPACE" --scheme "$XCODE_SCHEME"
artifacts:
- build/ios/ipa/*.ipa
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
- /tmp/xcodebuild_logs/*.log
- '*.snap'
- build/windows/**/*.msix
- flutter_drive.log
Project folder structure is as follows:
Xcode configurations as follows:
Schemas are as follows:
You don't need to use
xcode-project build-ipa
command because it re-builds ipa without flavor information.Check this project out to see working demo of building Flutter flavors.
https://github.com/codemagic-ci-cd/codemagic-sample-projects/blob/main/flutter/flutter-flavors-demo-project/codemagic.yaml
And there is also extra whitespace before
flavor
in your command