The executable was signed with invalid entitlements. (0xE8008016)

Update 2014/03/12 This QuickLook plugin is a great way of seeing what’s in your provisioning profiles: https://github.com/chockenberry/Provisioning

The code signing for iPhone apps can drive me batty sometimes.  It rarely works first time for me and the errors you get are completely unhelpful.  It doesn’t help that for a variety of reasons I’ve 3 developer profiles on my work machine.

Today, I’ve been getting the following:

The executable was signed with invalid entitlements.

The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.

(0xE8008016)

The very least they could do here is list which entitlements are not matching.  To figure this out, you need to view the provisioning profile and find the Entitlements key.  It’ll look something like this:

<key>Entitlements</key>        
<dict>                
    <key>application-identifier</key>               
    <string>7X895L3TS6.com.your.app</string>                
    <key>aps-environment</key>                
    <string>development</string>                
    <key>get-task-allow</key>                
    <true/>               
    <key>keychain-access-groups</key>                
    <array>                        
        <string>7X895L3TS6.*</string>                
    </array>       
</dict>

You need to make sure the contents of your Entitlements.plist match these exactly.  After you’ve made your change, clean your project and rebuild.  Your app should now install and run on your device.