Why this happens
When you archive an app for App Store distribution, Xcode embeds a provisioning profile inside the .xcarchive. That profile contains a set of entitlements — including the application-identifier (team ID + bundle ID) — that must exactly match the entitlements compiled into your app binary. If they diverge, the upload validation step rejects the archive with:
Profile doesn't match the entitlements file's value for the application-identifier entitlement
Common causes:
- Stale provisioning profiles cached locally that still reference an old team ID, bundle ID, or capability set.
- Capability changes (e.g., enabling/disabling iCloud, Push Notifications, App Groups) that Xcode hasn’t yet propagated to a fresh profile.
- Manual profile management where a downloaded profile doesn’t reflect the current target configuration.
Xcode normally regenerates profiles automatically when you toggle capabilities, but sometimes the local cache gets out of sync.
How to fix it
1. Toggle a capability to force profile regeneration (quickest)
The accepted workaround flips a capability on and off, which prompts Xcode to request a new, matching profile from Apple’s servers.
- Open your project in Xcode.
- Select the target (not the project) → Signing & Capabilities tab.
- Click + Capability, search for iCloud, and add it.
- Wait for Xcode to finish “Signing” (spinner in the toolbar).
- Try Product → Archive. It will likely fail — that’s expected.
- Return to Signing & Capabilities, remove the iCloud capability you just added.
- Archive again. This time it should succeed, and Xcode will have fetched a fresh profile whose entitlements match.
Why this works: Adding then removing a capability forces Xcode to invalidate the cached profile and pull a new one that reflects the current entitlements (without iCloud). The new profile’s
application-identifiernow matches the binary.
2. Delete all local provisioning profiles (clean slate)
If toggling doesn’t help, nuke the local cache so Xcode must download fresh profiles for every team and app.
- In Finder, press ⌘⇧G (Go to Folder).
- Paste:
~/Library/MobileDevice/Provisioning Profiles/
(On older Xcode versions the path may be~/Library/MobileDevice/Provisioning/.) - Select all
.mobileprovisionfiles and move them to Trash. - In Xcode, open Settings → Accounts, select your Apple ID, click Manage Certificates…, then Download Manual Profiles (or just wait for automatic sync).
- Clean build folder (Product → Clean Build Folder, ⌘⇧K).
- Archive again.
Tip: After deleting, Xcode will re-download only the profiles it needs for the currently selected signing certificate and bundle ID.
3. Verify the embedded profile matches (diagnostic step)
If the error persists, inspect the profile actually embedded in the archive:
- After a failed archive, right-click the archive in Organizer → Show in Finder.
- Right-click the
.xcarchive→ Show Package Contents. - Navigate to
Products/Applications/YourApp.app/embedded.mobileprovision. - Run in Terminal:
bash
security cms -D -i embedded.mobileprovision > profile.plist
cat profile.plist - Check the
Entitlements→application-identifiervalue. It must equalTEAMID.BUNDLE_IDexactly (no extra prefixes/suffixes).
How to prevent it
- Keep “Automatically manage signing” enabled for most projects — Xcode handles profile updates.
- Change one capability at a time, then archive, to catch mismatches early.
- Clean build folder after adding/removing capabilities before archiving.
- Avoid manually downloading profiles from the Developer Portal unless absolutely necessary.
- Use a dedicated CI machine with a clean keychain/profile cache for release builds.
FAQ
Does this error only happen with iCloud?
No. Any capability change (Push Notifications, App Groups, Wallet, etc.) can cause the same mismatch if the local provisioning profile isn’t refreshed. The iCloud toggle is just a convenient trigger because it’s quick to add/remove.
Will deleting profiles break other projects?
Temporarily, yes — Xcode will re-download profiles for all teams/apps the next time you build each project. It’s safe; just allow a few extra seconds on the first build per project.
What if I’m using manual signing?
Ensure the profile you select in Signing & Capabilities → Provisioning Profile is the exact one you downloaded after the latest capability change. Delete the old profile from the Portal and Xcode, download the new one, then select it explicitly.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
