Unity3D for iOS: “The Executable was signed with invalid entitlements” message from Xcode (Xcode install) and “Failed to Install” from device (iTunes install)

When to install via iTunes, Device says this after almost finishing install progress bar when installing with Dev Provisioning Profile:

"Failed to Install" 

When tried via Xcode’s Organizer, get this message:

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

Looks like Code Signing issue when I tried moving .p12 files to another machine and publishing from that other machine.

When I looked in KeyChain Access on my main machine, under “Keys” in the left side Category menu, the MyCompanyPrivateKeyName had “iPhone Developer: SoAndSo ($*@#&&#$)” certificate. BUT on my 2nd machine, the one I tried moving the .p12 files to, MyCompanyPrivateKeyName listed the “iPhone Distribution: Company Name” certificate. I had to delete the Certificates and Private Keys in KeyChain Access and then re-install them, making sure I install the Dev .p12 file first.

This didn’t fix the problem, however.

After some more poking around, I noticed that, since I had more than one developer certificate installed on that machine (my personal one and 2 company ones), Xcode was by default picking up the wrong Dev Provisioning Certificate and trying to incorrectly use it to code sign my .ipa. To fix this, in Xcode I had to

  • select the project name in the Navigator (left side bar in Xcode)
  • select Unity-iPhone under Project or Targets
  • select the Build Settings tab
  • find the Code Signing section & make sure the “iPhone Developer” profile specified there is correct and matches your app’s Bundle Identifier (com.yourCompany.YourAppName, unless you’re using a generic one via the “*” wildcard)