Sub topic 9
Signing iOS apps: certificates, profiles, and Xcode
Assume you know basic Flutter development, can use the terminal, and have macOS with Xcode installed. You also need an Apple Developer Program membership to sign an app for a physical device or distribution.
iOS signing proves who built an app and which app capabilities it may use. Apple combines three pieces:
- A certificate identifies the developer or distribution organization.
- An App ID identifies your app by its bundle identifier.
- A provisioning profile connects the certificate, App ID, entitlements, and allowed devices or distribution method.
The bundle identifier must be unique, such as com.example.weather. It is the iOS equivalent of an Android application ID.
How the pieces fit together
For local development, Xcode commonly uses an Apple Development certificate and a development provisioning profile. The profile allows the app to run on selected development devices.
For TestFlight or App Store submission, Xcode uses an Apple Distribution certificate and a distribution profile. The distribution profile describes the intended channel, such as the App Store.
A profile also contains entitlements. Entitlements are permissions and capabilities, such as push notifications, Sign in with Apple, or iCloud. If the profile and the app's capabilities disagree, signing or installation can fail.
Configure signing in Xcode
Flutter stores the iOS project in the ios directory. Open the workspace rather than the project file because the workspace includes CocoaPods dependencies.
flutter build ios --release --no-codesign
open ios/Runner.xcworkspaceIn Xcode:
- Select the Runner project in the navigator.
- Select the Runner target.
- Open Signing & Capabilities.
- Choose your Team.
- Set a unique Bundle Identifier, such as
com.example.weather. - Enable Automatically manage signing.
With automatic signing, Xcode creates or updates the development certificate and provisioning profile when possible. This is the simplest choice for one team using standard capabilities.
For each enabled capability, confirm that the matching service is enabled for the App ID in the Apple Developer portal. For example, enabling Push Notifications in Xcode is not enough by itself. The App ID must also support push notifications, and the profile must be regenerated.
Automatic and manual signing
| Approach | Best for | Main risk |
|---|---|---|
| Automatic signing | Local development and small teams | Xcode changes profiles without a central review |
| Manual signing | Controlled CI or multiple release environments | Profiles and certificates must be created and renewed carefully |
Manual signing is useful when a CI system must use a specific profile. In the target's Build Settings, choose the required signing certificate and provisioning profile for the relevant configuration, such as Release. Do not commit private certificates, passwords, or exported signing keys to the repository.
Common signing failures
- “No profiles for” usually means the bundle identifier, team, or profile does not match.
- “Signing certificate is invalid” can mean the certificate expired or its private key is missing from the Mac.
- The app installs but a feature fails often means an entitlement was enabled in code but not in the App ID or profile.
- A device cannot install the app may mean the device is not registered for development, or the profile has expired.
- CI succeeds locally but fails remotely often means the CI machine lacks the certificate's private key or the expected profile.
Keep the bundle identifier stable after release. Changing it creates a different App Store app instead of updating the existing one.
Exercise
Your Flutter app has Push Notifications enabled in Xcode, but release signing fails because the entitlement is missing. What should you check?
Show answer
Check that Push Notifications is enabled for the same App ID in the Apple Developer portal, then regenerate or let Xcode recreate the provisioning profile and verify that the correct profile is selected for the Release configuration.