Introduction
When archiving a Flutter iOS app for App Store submission, Xcode may fail with bitcode-related errors. Since Xcode 14, bitcode is deprecated and no longer supported for new submissions, but some dependencies or project settings may still reference bitcode configuration, causing archive failures. Additionally, Flutter's default build settings may conflict with Xcode's archive process.
Symptoms
- Xcode Archive fails with:
`- error: BITCODE is not supported. Turn off bitcode and try again.
`- Or:
`- '.../Flutter.framework/Flutter' does not contain bitcode.
- You must rebuild it with bitcode enabled (ENABLE_BITCODE=YES).
`- Archive succeeds but validation fails during App Store Connect upload
- Error during
flutter build ipa: `- error: Archive failed: bitcode bundle could not be generated
`
Common Causes
- Podfile or project settings still referencing bitcode
- Third-party native dependencies compiled with bitcode
- Xcode 14+ deprecating bitcode while old settings persist
- Flutter framework not rebuilt for the current Xcode version
- Mismatched deployment target between pods
Step-by-Step Fix
- 1.Disable bitcode in Xcode project settings:
- 2.- Open
ios/Runner.xcworkspacein Xcode - 3.- Select the Runner project in the navigator
- 4.- Select the Runner target
- 5.- Go to Build Settings
- 6.- Search for "Bitcode"
- 7.- Set "Enable Bitcode" to
NOfor all configurations - 8.Update Podfile to disable bitcode for all pods:
- 9.```ruby
- 10.# ios/Podfile
- 11.post_install do |installer|
- 12.installer.pods_project.targets.each do |target|
- 13.flutter_additional_ios_build_settings(target)
- 14.target.build_configurations.each do |config|
- 15.config.build_settings['ENABLE_BITCODE'] = 'NO'
- 16.config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
- 17.end
- 18.end
- 19.end
- 20.
` - 21.Reinstall pods with updated settings:
- 22.```bash
- 23.cd ios
- 24.rm -rf Pods Podfile.lock
- 25.pod install
- 26.cd ..
- 27.
` - 28.Clean and rebuild the IPA:
- 29.```bash
- 30.flutter clean
- 31.flutter pub get
- 32.flutter build ios --release --no-codesign
- 33.flutter build ipa
- 34.
` - 35.If using Xcode 14+, verify bitcode is fully deprecated:
- 36.```bash
- 37.# Check Xcode version
- 38.xcodebuild -version
# Xcode 14+ should not require bitcode at all # If you see bitcode errors, the issue is likely an old setting ```
- 1.Verify archive with xcodebuild:
- 2.```bash
- 3.# Archive from command line
- 4.xcodebuild -workspace ios/Runner.xcworkspace \
- 5.-scheme Runner \
- 6.-configuration Release \
- 7.-archivePath build/Runner.xcarchive \
- 8.archive
# Validate the archive xcodebuild -validateApp \ -archivePath build/Runner.xcarchive \ -exportOptionsPlist ios/ExportOptions.plist ```
Prevention
- Set
ENABLE_BITCODE = NOin your Podfile post_install hook - Keep iOS deployment target at 12.0 or higher
- Run
flutter build ipainstead of manual Xcode archiving when possible - Keep Xcode updated to the latest stable version
- Use
flutter doctor -vto verify iOS toolchain compatibility - Document build settings in your project README for team consistency
- Add a CI/CD step that runs
flutter build ios --release --no-codesignon every PR to catch archive issues early - Pin the Xcode version in your CI configuration to avoid unexpected bitcode setting changes from Xcode updates