-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Problem Statement
The flutter build ipa command fails during the export step when using manual code signing for iOS release or profile builds that include Push Notifications and Sign in with Apple entitlements. The archive step succeeds, but the export fails due to an incomplete ExportOptions.plist configuration.
Reproduction Steps
-
Configure an iOS project with manual code signing:
- Set
CODE_SIGN_STYLE = Manualin Xcode project settings - Set
PROVISIONING_PROFILE_SPECIFIERto a distribution profile name or UUID - Configure the app with Push Notifications and Sign in with Apple entitlements
- Set
-
Run:
flutter build ipa --release
-
Result:
- ✅ Archive step completes successfully
- ❌ Export step fails:
error: exportArchive: "Runner.app" requires a provisioning profile with the Push Notifications and Sign in with Apple features.
Root Cause
The provisioning profile contains the required entitlements. The failure occurs because xcodebuild -exportArchive requires a complete ExportOptions.plist with teamID and provisioningProfiles mapping when using manual signing. Flutter's default generated plist only includes method and uploadBitcode, which is insufficient.
Current Workaround
Manually create an ExportOptions.plist with:
method = app-store(or ad-hoc, enterprise, etc.)teamID = <TEAM_ID>signingStyle = manualprovisioningProfiles = { "<bundle id>": "<profile UUID>" }
Then run:
flutter build ipa --release --export-options-plist=ios/ExportOptions.plistThis succeeds and produces a valid IPA.
Impact
Developers using manual code signing for App Store distribution with Push Notifications and/or Sign in with Apple entitlements are blocked. This requires manual creation and maintenance of ExportOptions.plist files, adding friction to development workflows and CI/CD pipelines.
Related issues:
- Support
flutter build ipawith manual signing and provisioning profiles #106612 - Supportflutter build ipawith manual signing and provisioning profiles - Flutter build IPA with --export-options-plist not working #113977 - Flutter build IPA with --export-options-plist not working
Proposed Solution
Auto-generate a complete ExportOptions.plist for manual signing configurations when:
CODE_SIGN_STYLE=Manualis detected (Release or Profile builds)- A valid provisioning profile can be located and parsed
- Only for the main app target (not extensions/widgets)
The generated plist will respect the user's export method choice:
- Export method: whatever the user specified with
--export-method(app-store, ad-hoc, enterprise, etc.) - Team ID: from the project's
DEVELOPMENT_TEAMsetting - Signing style: "manual"
- Provisioning profiles: auto-detected from system profiles
Fallback behavior:
- If profile lookup fails or conditions aren't met, use current behavior (simple plist)
- Automatic signing: unchanged
- Debug builds: unchanged
- Multi-target apps: unchanged
Testing Instructions
To verify the fix:
- Create an iOS app with
CODE_SIGN_STYLE=Manualand Push Notifications entitlements - Run
flutter build ipa --release --verbose - Verify ExportOptions.plist contains:
teamID(from DEVELOPMENT_TEAM setting)signingStyle= "manual"provisioningProfilesmapping with correct profile UUID
Questions for Maintainers
- Is this scoped approach acceptable for inclusion in flutter_tools?
- Should this enhancement support multiple targets (extensions/widgets) in a future iteration, or is the single-target scope sufficient for v1?
Feedback welcome. I have a working implementation with comprehensive unit tests ready for PR.