72

I am having a problem with ad-hoc distribution on my iPhone. I have developed an application with SDK 3.0. I have a developer's license. I have added certificates and provisioning profiles in my project. So, no problem with that.

But, when I try to install the app on my iPhone, it compiles the project and then displays the error: "The executable was signed with invalid entitlements" in the Organizer window. Am I missing something? I have upgraded my iPhone from 2.2.1 and have downloaded latest SDK from Apple.

Please help me with this issue.

YOU's user avatar

YOU

125k34 gold badges192 silver badges222 bronze badges

asked Jul 2, 2009 at 14:03

51

There are pretty good instructions in the 'Portal Program'. If you log into

http://developer.apple.com/iphone

Then click Distribution on the left, and click the

Creating and Downloading a Distribution Provisioning Profile for Ad Hoc Distribution

link at the bottom.

Here's the key bit:

For Ad Hoc Distribution, complete the following:

  • 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.
  • Select the new Entitlments.plist file and uncheck the “get-task-allow” property. Save the Entitlements.plist file. (in Xcode 4, get-task-allow is called "Can be debugged" )
  • Select the Target and open the Build settings inspector. In the ‘Code Signing Entitlements’ build setting, type in the filename of the new Entitlements.plist file including the extension. There is no need to specify a path unless you have put the Entitlements.plist file somewhere other than the top level of the project.
  • Click ‘Build’. (Note: Your binary must contain a flattened, square-image icon that is 57x57 pixels. This icon is displayed on the iPhone or iPod touch home screen.)

answered Jul 2, 2009 at 15:56

John's user avatar

6 Comments

I was just going to write the same thing, it's easy to forget you need the get-tak-allow for ad-hoc in addition to store builds!

This didn't work for me — it resulted in the same "invalid entitlements" error. But based on some comments below, I cleared everything, and then CHECKED (not unchecked) "get-task-allow", and tried again -- this time it worked.

I had this same problem with an old project that I updated from git-hub, and checking that property (when I recall it was previously unset) also seemed to cure my issue as well. Strange.

Wow, that just saved me about 12 hours of head-banging. Thanks.

Thanks for this, surprising how this stuff is so hard to find on Apple's site, it seems SO is a better resource.

|

34

This error also may occur if you're trying to profile an app where the device is not included in the provisioning profile.

Make sure your device is included in the dev provisioning profile you want to use. Somehow the error message is misleading. My entitlements were actually ok.

answered Jul 5, 2011 at 12:35

TTT's user avatar

TTT

3663 silver badges2 bronze badges

Comments

14

I have found that "get-task-allow" needs to be checked for Development builds but unchecked for Distribution builds. The easiest way to accomplish this (AFAIK) is to have two entitlements files in your project: Entitlements.plist and EntitlementsDebug.plist - and to reference the proper one in the build project settings for the various configurations in your project.

answered Jan 26, 2010 at 17:14

gumbypp's user avatar

gumbypp

1591 silver badge2 bronze badges

3 Comments

I have never needed to do this. For your development build configuration, just make sure that Code Signing Entitlements is blank.

get-task-allow unchecked worked for me... what a sneaky little bastard

I too had to check get-task-allow to get a developement build on my device.

6

Code signing entitlements are no longer necessary for Ad Hoc builds in Xcode 4 - see details notes in Apple Technical Note TN2250

Cœur's user avatar

Cœur

39.1k25 gold badges207 silver badges283 bronze badges

answered Aug 11, 2011 at 20:20

snibbe's user avatar

snibbe

2,7481 gold badge28 silver badges35 bronze badges

Comments

5

If you once come into the situation, that checking "get-task-allow" seems to be required in order to deploy your debug (!) build to your phone, check this:

a) Check the build setting. There should be no entry in "Code Signing Entitlements" for Debug b) Remove Entitlements.plist temporarily and build your debug version. If it complains about a missing Entitlements.plist, then you probably have the same situation, I had to fight today. c) Build again with Entitlements.plist and enable "get-task-allow". If it works now, you probably have the same problem:

After messing around with new profiles I couldn't deploy my Debug build to the phone. AdHoc was fine. I checked a) - empty.. Hmm. I checked b) - complains. c) - worked...

After all I examined project.pbjproj in an editor and - although the GUI did claim, that there was no entry for "Code Signing Entitlements" in fact there was one in the Debug section. I emptied it and was done.

answered Oct 19, 2010 at 12:19

neil's user avatar

neil

1111 silver badge4 bronze badges

1 Comment

This worked for me. After I added an Entitlements.plist for AdHoc, xcode copied that requirement to my Debug and Release targets (although I did not enter that in the Build tab). After removing from the pbxproj file by hand, the Debug build works again.

4

This is because your device, on which you are running your application is not selected with your provisioning profile.

So just go through Certificates, Identifiers & Profiles select your iOS Provisioning Profiles click on edit then select your Device

enter image description here

answered Jun 25, 2013 at 10:02

Rajneesh071's user avatar

Rajneesh071

31.1k15 gold badges63 silver badges74 bronze badges

Comments

3

I have just had an exciting three hours battling with this. I have just upgraded a project to 4.2 and for some reason it just wouldn't work.

I eventually removed the Entitlements.plist file and then created a new one.

File > New File > Code Signing > Entitlement

Name the file Entitlements.plist

Make sure it's in the Resources group in xCode.

It didn't put in the get-task-allow BOOL type in the Entitlements.plist file. I added it, checked it, saved it, unchecked it, saved it. This made me feel better.

I then removed the Adhoc and Release profiles I had created. Re-downloaded them from the Provisioning Portal and droped them back into the xCode organizer.

I then went into Build Settings and made sure the correct profiles were assigned to the Debug and Release profiles.

I then changed the to Release / Device. Hit the build button and it worked.

I have no idea why.

answered Dec 14, 2010 at 3:28

Gerald's user avatar

Comments

1

John's answer is 99% correct. I found that (at least in my configuration), you have to open the Build settings inspector for the PROJECT. The build settings for the target do not contain "Code Signing Entitlements". Perhaps this doesn't make a difference if you have only one target in your project. But if you have multiple targets, you need to go to the project build settings. In any case, after doing what John said, my ad-hoc distribution build worked perfectly.

answered Oct 8, 2009 at 22:22

iisystems's user avatar

iisystems

1,1771 gold badge11 silver badges12 bronze badges

2 Comments

That's odd, because I have Code Signing Entitlements under the Target settings in XCode 3.1.

Code Signing Entitlements will appear if you make the Base SDK iPhone Device not Simulator in the target.

1

In Xcode 5.1, if you go into Preferences -> Accounts -> View Details...

Make sure the Signing Identity status is Valid. If it says Revoked, hit the Plus button and add the appropriate signing identity: iOS Development or iOS Distribution. Xcode will replace it with a new, valid one.

answered Apr 1, 2014 at 17:13

TalkLittle's user avatar

TalkLittle

9,1616 gold badges58 silver badges53 bronze badges

Comments

1

For me that solved it: https://coderwall.com/p/-ckobg

  1. Open Project.xcodeproj > project.pbxproj
  2. Remove all lines like these:
    1. PROVISIONING_PROFILE = ...
    2. "PROVISIONING_PROFILE[sdk=iphoneos*]" = ...
    3. CODE_SIGN_IDENTITY = ...
    4. "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ...
  3. Set provisioning profiles & code signings for the target again

answered Sep 9, 2014 at 14:26

Robert's user avatar

Robert

4317 silver badges19 bronze badges

1 Comment

This solved my problem. It was specifically the line CODE_SIGN_IDENTITY = ... that caused the problem. I have no idea when this was added by Xcode, or if I did it by mistake myself, but what a mess. Compared to other IDE's I have had so many weird problems with Xcode. I try to avoid it and stick to AppCode.

0

pJosh, this might help understanding. In my case, my Team Provisioning Profile was expiring (the Provisioning Portal indicated it is managed by XCode), as well as the device testing profile for the app. (I still don't know why, but the portal had a "Renew" button next to the team profile, but it wouldn't do anything when I clicked it.)

So, I deleted the profiles about to expire, then in XCode go to Organizer (Command-Shift-2), under Library / Provisioning Profiles, I deleted the expiring ones. Then click "Refresh" at the bottom, enter my Apple ID, and it renewed the expiring ones.

Finally, on my Target, I went to Build Settings, Code Signing, and made sure to select the provisioning profile. Voila, now it builds to my device.

answered Sep 9, 2011 at 10:18

Jay Imerman's user avatar

Jay Imerman

4,6807 gold badges48 silver badges62 bronze badges

Comments

0

Just got this same error code. It seems there are different things that cause this and therefore different ways to fix it.

In my case, I had two different devices with the same name (an iPhone 4 and an iPhone 4S). Changing the name of one of them fixed this error completely for me...

answered Jan 16, 2012 at 4:48

Andy Ibanez's user avatar

Andy Ibanez

12.3k9 gold badges68 silver badges104 bronze badges

Comments

0

I was trying to add iCloud support to my existing app, but found that after adding entitlements and configuring iCloud, my app would no longer debug.

I realised that my generic iOS development certificate had a different APPID from the app I was working on. So to fix it, instead of using my generic certificate I created a specific development certificate for that APPID.

I refreshed my provisioning profile in XCode, cleaned out the app, disconnected my device, restarted XCOde and connected device and ran, and it now works a treat!

answered Oct 23, 2012 at 16:15

theDuncs's user avatar

theDuncs

4,8635 gold badges44 silver badges64 bronze badges

Comments

0

I also spent several hours fighting with this as well. The fix is real simple. Edit your Entitlements.plist file in the root of your project's directory. Find the line that says <key>get-task-allow</key>. Underneath it should be <false/>. Change that to <true/>.

answered Nov 29, 2012 at 15:46

Brian Knoblauch's user avatar

Comments

0

Sorry that this is very late, but I just was looking at this question and found something that worked for me. I went to PROJECT->Build Settings and found the Code Signing section. Beside debug, my distribution profile that said Iphone Distribution: MY NAME was selected. I instead selected Iphone Developer: MY NAME on the drop-down list under IpodProfile (for bundle identifiers com.myName.myApp which was the provisioning Profile for my device. Hope this helps!

answered May 4, 2013 at 14:19

John Farkerson's user avatar

Comments

0

I just had this happen to a developer on the team I administer.

It turned out his developer certificate expired and after renewal, I neglected to add his certificate to the provisioning profile his app used. enter image description here

answered Mar 17, 2014 at 12:34

sean808080's user avatar

Comments

0

I had not agreed to the new updated licensed agreement from apple.

Briefly : Please log in to your developer's account -> profile's -> review -> read the agreement or get your lawyer read it for you -> agree (at your own will) -> and again click profile's to check the status of your profile.

In my scenario the valid code signing entity was not showing up. When i followed the above procedure it was visible and i was able to run the app on the device and/or create the iPA file without much difficulty.

answered Jul 15, 2014 at 6:15

iCodeAtApple's user avatar

Comments

0

Had this issue occur when everything seemed to be setup correctly, build setting were pointing to correct provisioning profile, code signing was properly setup, etc.

Issue occurred because I had just created a new scheme and hadn't regenerated my CocoaPods for the new configurations. As you can see from the image, the new ad-hoc configuration is pointing to the Pods.production configuration, instead of a Pods.ad-hoc configuration (and test respectively)

Demonstrating a mis-match of ad-hoc configuration and scheme configuration

To fix:

  • Set the offending configuration to None -- cocoapods wouldn't generate the configs unless I did this
  • Close XCode
  • Run pod install
  • Re-open XCode and set the new scheme's configurations to the newly generated configurations.

That's it!

answered Oct 24, 2014 at 17:21

Gavin Miller's user avatar

Gavin Miller

44k22 gold badges130 silver badges191 bronze badges

Comments

-1

Check if you're device is included in the provisioning profile.

answered Jan 6, 2013 at 14:45

Steve Ham's user avatar

Steve Ham

3,2021 gold badge31 silver badges37 bronze badges

Comments