Search This Blog

Thursday, June 9, 2011

Upgrading iTunes and Entitlements...

On my development machine I suddenly get this message when I go to rebuild one of my iPhone apps:  "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)."

Huh?  Entitlements?

I have a demo in the next hour or so and now I cannot install my iPhone app because of "entitlements".

(Thanks Apple.  While its great you are doing all of this neat stuff for the world how about some mercy on  Joe Average developer?  New development environment and iOS releases appear every three months or so jammed with a million tiny gotchas that make a developer life frustrating.  I run off-the-shelf XCode and iOS development stuff - I change nothing and run the apps and tools "as-is" off the developer site.  Sadly for me, I also use iTunes on the same machine - which gets upgraded about once a week - often causing weird, flaky interactions with the development environment and devices.)

I think back - what's changed since the problem began?

(Long ago I learned this is the key question in any computer situation.)

Well, iTunes told me it was going to upgrade itself - specifically for the new iPhone push/cloud nonsense.  That happened a few hours ago...  now what?

I quick search of StackOverflow yields lots of posts like this one.  Lot's of developers complain about this but little in the way of solutions is immediate obvious.  Then, after a frantic 30 minutes, I triangulate on these steps:

1. In the File Menu, select New File -> iPhone OS -> Code Signing -> Entitlements. Name the file “Entitlements.plist" and click ‘Finish’. This creates a copy of the default entitlements file within the project.

2. Select the new Entitlments.plist file and uncheck the “get-task-allow” property. Save the Entitlements.plist file.  (In XCode 4 this does not work right.  You do not see anything like "get-task-allow" in the plist editor - it shows something unrelated.  You have to open it as text in some outside editor in which case you see it as a plist dictionary entry with a true tag.  You have to edit this to false.)

3. Go to the developer portal, re-create the provisioning for the device with a new name.  (It will crap out after a couple of minutes saying it failed.  But if you look under the tab where you can see existing profiles the new one will be there after all.  More frustration and thrashing.  Thanks again Apple!)

I think the Apple provisioning site is wedged because you have to rebuild with a new provisioning profile if you upgrade to the latest iTunes - but that's just my personal speculation.  Somehow "get-task-allow", iTunes 10.3.1.(55), and XCode 4 require this.

4. Delete the old provisioning from the device manually (Settings -> General -> Profiles) and remove it from "Provisioning" section of the "Organizer" in XCode 4.

5. Stick the Entitlements.plist file into the project at the top level - right before any folders with code.

6. Rebuild.

The iTunes upgrade was to 10.3.1 (55) - I run a fully updated 10.6.7 generic development machine.

The devices (iPad, iPhone) are generic off-the-shelf devices, no jailbreaks, fully upgraded to the latest version of iOS (4.3.3 8J2 on the iPhone, 4.3.3 8J3 on the iPad).

No comments:

Post a Comment