In Xcode, how do automatic and manual signing differ under CODE_SIGN_STYLE, and what must a provisioning profile authorize for an app and its widget extension?
answer
- who creates profiles, App IDs, certificates
- one profile per executable bundle
- profile ties App ID, certificate, devices
- entitlements file versus what profile allows
- PROVISIONING_PROFILE_SPECIFIER with DEVELOPMENT_TEAM
basics
~20 sWith CODE_SIGN_STYLE Automatic, Xcode creates and updates profiles, App IDs and certificates; with Manual you create them and name each profile. The app and its widget extension each need a profile that authorizes the entitlements they claim, such as an App Group.
solid answer
~50 s`CODE_SIGN_STYLE` chooses who manages signing assets. **Automatic** lets Xcode create and update provisioning profiles, App IDs and certificates, and adding a capability configures them. **Manual** means you create them on the developer website and set `PROVISIONING_PROFILE_SPECIFIER` (a profile name or UUID) with `DEVELOPMENT_TEAM`; a missing or invalid profile is a build error. A **provisioning profile** is tied to an App ID, so to the bundle identifier; a development profile also lists the devices allowed to run the build, and the profile must authorize the entitlements the target's entitlements file claims. The widget extension is its own executable with its own bundle identifier and profile, so when app and widget share an App Group, both entitlements files list the group and both profiles must authorize it. Under manual signing, forgetting to regenerate the extension's profile is the classic failure.
code
plaintext · 6 lines// Release.xcconfig for the widget extension target, manual signing
CODE_SIGN_STYLE = Manual
DEVELOPMENT_TEAM = A1B2C3D4E5
CODE_SIGN_IDENTITY = Apple Distribution
PROVISIONING_PROFILE_SPECIFIER = MealKit Widget App Store
CODE_SIGN_ENTITLEMENTS = MealKitWidget/MealKitWidget.entitlementsgo deeper
Know that each target is signed with a certificate and a provisioning profile, and that the Signing & Capabilities pane holds the Automatically manage signing switch.
Explain what CODE_SIGN_STYLE changes, why an extension needs its own profile, and how a profile must authorize the entitlements a target claims.
Diagnose a release that fails only on the widget extension by checking its App ID capabilities, its regenerated profile and its entitlements file in turn.
Decide which configurations sign automatically and which manually, who owns the distribution certificate, and how that rule survives people leaving the team.
## What gets signed, and with what On iOS the app is code-signed, and so, separately, is each embedded extension, such as a widget extension, and each framework embedded with Embed & Sign. Signing involves three different things that candidates often blur: - **Signing certificate (identity)**: proves which team built the code. `CODE_SIGN_IDENTITY` names it by its common name, and a missing or invalid certificate is a build error. Export options name certificate kinds such as Apple Development and Apple Distribution. - **Provisioning profile**: a document issued for one App ID, so for one bundle identifier, that says which certificates may sign it, which devices may run it (for development and ad hoc profiles) and which entitlements it may claim. - **Entitlements**: claims the binary makes, such as App Groups or keychain sharing, kept in the file named by `CODE_SIGN_ENTITLEMENTS`. Apple's documentation is explicit that a provisioning profile needs to authorize most entitlement claims. ## Automatic versus manual `CODE_SIGN_STYLE` is the **Automatically manage signing** checkbox in the Signing & Capabilities pane. | | Automatic | Manual | |---|---|---| | Profiles, App IDs, certificates | Xcode creates and updates them | you create them on the developer website | | Adding a capability | Xcode edits the entitlements file and configures the App ID and profile | Xcode edits the entitlements file; you enable the capability on the App ID and regenerate the profile | | Choosing a profile | Xcode picks one | `PROVISIONING_PROFILE_SPECIFIER` plus `DEVELOPMENT_TEAM` | | Running on a new device | Xcode registers the device and adds it to the development profile | you register it and regenerate the profile | Apple recommends keeping the default automatic signing from the project templates, and warns that with manual signing you perform the capability configuration steps yourself. Teams still choose manual signing for release builds when one person or one CI machine owns the distribution certificate. ## The widget extension is its own signing problem The meal-kit widget shows today's recipe, read from a shared App Group container that the app writes. That one feature touches two executables: 1. Both the app target and the widget extension target add the **App Groups** capability with the same `group.` identifier, so both entitlements files claim it. 2. The app's App ID and the widget's App ID both need the App Groups capability enabled, with the group registered for the team. 3. Each target gets its own provisioning profile, and each profile must authorize the group. Under automatic signing Xcode does steps 2 and 3 when you tick the capability. Under manual signing the usual break is that the widget's App ID never had App Groups enabled, or its profile was not regenerated afterwards, so the extension fails at signing while the app looks fine. Apple's own capability guides describe the same repair: enable the capability for the App ID, regenerate the profile, and repeat the steps for each extension's profile. ## Signing outside the IDE - `xcodebuild -allowProvisioningUpdates` lets the command line talk to the developer website: for automatically signed targets it creates and updates profiles, App IDs and certificates; for manually signed targets it downloads missing or updated profiles. - When exporting an archive, the export options can set `signingStyle`, and for manual signing a `provisioningProfiles` dictionary keyed by each executable's bundle identifier, which is the same one-profile-per-executable rule written down. - Syncing certificates and profiles across a team with a fastlane tool, and setting up a CI keychain, is covered with fastlane's signing tools. ## Sharing identities on a manual team Xcode creates cloud-managed certificates and shares them across the team, so nobody exports those by hand. A team that manages identities itself exports the distribution identity from Xcode's Accounts settings as a password-protected PKCS#12 file. Apple's guidance is blunt about the risk: anyone with that file and its password can ship software that appears to come from your developer account, so use a strong password and send the file and the password through different channels. ## Reading the failure A signing failure names the target, so read which target failed before touching anything. The questions to ask, in order: 1. Does the target's bundle identifier match the App ID the profile was issued for? 2. Is the signing certificate one the profile allows, and is it in the keychain? 3. Does the profile authorize every entitlement in that target's entitlements file? 4. For a development or ad hoc build, is the device in the profile? Testers can run the app only on devices added to it.
- What does xcodebuild's -allowProvisioningUpdates do for each signing style?It lets `xcodebuild` contact the Apple Developer website. For automatically signed targets it creates and updates profiles, App IDs and certificates; for manually signed targets it downloads missing or updated provisioning profiles. It needs a developer account added in Xcode or an App Store Connect authentication key passed on the command line.
- Why does a development build install on one tester's iPhone but not another's?A development or ad hoc profile lists the devices allowed to run the build. The second iPhone was never registered and added to the profile. With automatic signing, choosing the device as the run destination registers it and updates the profile; with manual signing you register it and regenerate the profile.
- Can an App Store build use automatic signing?Yes. Automatic signing manages distribution assets too, and an archive signed automatically is re-signed automatically on export by default. Manual signing for release is a team choice about who controls the distribution certificate, not a requirement.
- One provisioning profile covers the app and all its extensions
- A profile and a signing certificate are the same thing
- Adding an entitlement to the file is enough under manual signing
- App Store builds require manual signing
- Automatic signing means Debug builds are not signed