Sub topic 10
Building an iOS Archive and IPA
This chapter assumes you can build a Flutter app in debug mode, use the terminal, and open an iOS project in Xcode. You also need macOS, Xcode, an Apple Developer account, and an iOS device for physical testing.
An iOS release has two related forms:
- An archive is a packaged build stored by Xcode. It contains the app, signing information, and metadata needed for distribution.
- An IPA is an installable iOS application package. You can upload it to App Store Connect or distribute it through supported testing and enterprise workflows.
Flutter coordinates the build, but Xcode handles much of the iOS signing and packaging process.
Prepare the iOS project
Run these commands from the Flutter project directory:
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter doctorflutter clean removes previous build output. pod install installs or updates CocoaPods dependencies when the project uses them. flutter doctor reports missing or misconfigured Flutter, Android, Xcode, or CocoaPods components.
Open the workspace, not the project file:
open ios/Runner.xcworkspaceThe workspace includes CocoaPods dependencies. Opening Runner.xcodeproj instead can cause missing-framework or linker errors.
Configure signing in Xcode
Select the Runner project in the Xcode navigator, then select the Runner target. Under Signing & Capabilities:
- Choose your Apple Developer team.
- Set a unique bundle identifier, such as
com.example.weather. - Enable Automatically manage signing unless your team requires manually managed profiles.
- Confirm that the selected signing certificate and provisioning profile match the release target.
A bundle identifier uniquely identifies the app to Apple. A signing certificate proves which developer or organization built the app. A provisioning profile connects the app identifier, certificate, and allowed devices or distribution method.
The bundle identifier in Xcode must match the identifier registered in App Store Connect. Changing it after creating an app record usually means creating or selecting a different app record.
![Xcode signing connects the project identity to an Apple team and distribution profile.]
Build the archive and IPA
Flutter can ask Xcode to create the archive and export an IPA:
flutter build ipa --releaseThe archive and IPA are normally written below build/ios. The IPA is commonly found in build/ios/ipa, while the archive is placed in an archive-related subdirectory.
You can also create an archive in Xcode:
- Select a real iOS device or Any iOS Device (arm64) as the run destination.
- Select Product > Archive.
- Wait for Xcode Organizer to open.
- Select the archive and choose Distribute App.
- Choose App Store Connect for TestFlight or App Store submission.
- Validate the archive, then upload it.
The archive must use a distribution signing configuration. A simulator destination cannot produce a distributable iOS archive.
Troubleshoot common failures
- No signing certificate found: Sign in to Xcode with the correct Apple account and select the team.
- Provisioning profile mismatch: Check that the profile supports the bundle identifier and distribution method.
- Bundle identifier already registered: Choose an identifier owned by your team.
- Archive is unavailable: Select a generic iOS device instead of a simulator.
- Upload rejects the build number: Increase the build number before creating another archive.
The version value in pubspec.yaml supplies the marketing version and build number. For example, 2.1.0+12 means version 2.1.0 and build 12. Apple requires every uploaded build to have a higher build number than the previous upload.
Exercise
Exercise
Why must you select a real device or “Any iOS Device (arm64)” instead of an iOS simulator when creating an archive?
Show answer
A simulator uses a different binary architecture and runtime. A distributable archive must contain a device build that can be signed and uploaded for physical iOS devices.