Why this happens
An entitlement is a permission that is written into your app’s signature. iOS only grants it if three things agree: the .entitlements file in your Xcode target, the App ID’s enabled capabilities on developer.apple.com, and the provisioning profile embedded in the build. When the device installs the app, it compares the signed entitlements against the profile. Any key that is present in one place and missing in another makes the install fail with The executable was signed with invalid entitlements.
The alert usually adds that the entitlements in your Code Signing Entitlements file do not match those in your provisioning profile, and often carries the code 0xE8008016.
There are two very common triggers. The first is a capability that Xcode adds to the entitlements file by default but that was never enabled on the App ID — the classic case is inter-app-audio, which older Xcode templates wrote as YES while the App ID created on the portal had no Inter-App Audio checkbox ticked. The second is a Development Team mismatch: the app target is signed for one team and the test target (or an extension) for another, so the bundle that actually gets installed carries entitlements from the wrong profile.
How to fix it
1. Diff your entitlements file against the App ID
Open the .entitlements file for the failing target (select the file in the Project navigator, or read it as source). It is a plist of keys such as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>inter-app-audio</key>
<true/>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
Now sign in to developer.apple.com, go to Certificates, Identifiers & Profiles → Identifiers, select the App ID that matches your bundle identifier, and look at its enabled capabilities.
For every key in the file there must be a matching capability on the App ID. Two ways to resolve a mismatch:
- You need the capability. Enable it on the App ID, save, then regenerate the provisioning profile (Edit the profile, or create a new one) and download it.
- You do not need it. Remove the key from the entitlements file. In the case of Inter-App Audio, deleting the
inter-app-audiokey is enough if your app does not use it.
After either change, do a clean build (Product → Clean Build Folder) so Xcode stops reusing the old signed product.
2. Make every target use the same Development Team
This one is easy to miss because Xcode shows signing settings per target. Select the project in the navigator, then walk the Targets list one by one and open Signing & Capabilities for each. The Team dropdown must be identical everywhere — app target, unit test target, UI test target, and any extensions or watch targets.
You can confirm from the command line instead of clicking through:
xcodebuild -project MyApp.xcodeproj -list
xcodebuild -project MyApp.xcodeproj -target MyAppTests -showBuildSettings | grep DEVELOPMENT_TEAM
Run the second command for each target and compare the values. If one target reports a different team (or an empty value), set it explicitly. Note that a target can inherit from the project-level build settings, so also check the project’s own DEVELOPMENT_TEAM under the Build Settings tab, not just the target’s.
If the test target does not need to run on a device at all, an alternative is to leave it signed for automatic signing with the same team rather than trying to give it its own profile.
3. Regenerate the profile and clear stale copies
Xcode caches provisioning profiles locally, and an old copy can survive a portal change. To force a refresh:
- Open Xcode → Settings → Accounts, select your Apple ID, select the team, and use Download Manual Profiles.
- If the problem persists, quit Xcode and remove the cached profiles from
~/Library/MobileDevice/Provisioning Profiles, then reopen Xcode and let it download them again. - Clean the build folder and delete the app from the device before running again.
4. Inspect what was actually signed
When the mismatch is not obvious, read the entitlements straight out of the built product and out of the embedded profile, then compare them side by side:
# Entitlements actually embedded in the signed app
codesign -d --entitlements :- /path/to/Build/Products/Debug-iphoneos/MyApp.app
# Entitlements the profile allows
security cms -D -i /path/to/Build/Products/Debug-iphoneos/MyApp.app/embedded.mobileprovision
The second command prints the whole profile plist; look at its Entitlements dictionary. Any key in the first output that is absent from the second is your culprit. This also tells you whether Xcode is signing with the profile you think it is — a stale or wrong profile shows up immediately here.
5. Check manual signing selections
If the target uses manual signing, the Provisioning Profile dropdown must point at a profile generated for the same App ID and the same team as the entitlements file. A profile from a different App ID will produce exactly this error even though the certificate itself is valid. Switching the target to automatic signing temporarily is a quick way to see whether the problem is a bad manual selection.
How to prevent it
- Enable capabilities on the App ID before adding them in Xcode, then regenerate the profile in the same sitting.
- Keep one Development Team across the app, tests, and extensions; check the test target after any team change.
- Avoid hand-editing
.entitlementsfiles; use Signing & Capabilities so Xcode and the portal stay in step. - After changing anything signing-related, clean the build folder and delete the old app from the device.
- When a build behaves strangely, run
codesign -d --entitlements :-on the product before guessing.
FAQ
Does this error mean my certificate or private key is broken?
No. A bad certificate produces different failures (for example errSecInternalComponent or a missing identity). This message specifically means the entitlements and the profile disagree, so look at capabilities and team settings, not at the keychain.
I enabled the capability in Xcode but it still fails. Why?
Enabling a switch in Xcode only edits your local entitlements file. The App ID on developer.apple.com and the provisioning profile must be updated too, and the profile has to be downloaded again before the device will accept the build.
Can I just delete the entitlements file to make the error go away?
Only if your app genuinely needs no capabilities. Deleting it removes push notifications, App Groups, Keychain Sharing and similar features, and if the profile still grants them you can hit a mismatch in the other direction. Remove the single offending key instead.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.