Dreaded "The executable was signed with invalid entitlements" - iphone

i have the "The executable was signed with invalid entitlements" error. The error only occurs when im trying to set TRUE to the Entitlements.plist of get-task-allow. The reason for trying to do this is because im trying to get the device token to be shown in the console, using the device token later for push notifications.
Though, if i set false to get-task-allow, the app would build in the iPad.
Currently using XCode SDK 3.2.3, iPad iOS 3.2.1
I Have tried everything from removing all the keys,certificates from the Mac. Revoking the certificates in the iPhone Provisioning Portal. Removing the provisioning profiles in the iPad. Then redoing everything all over again.
I also have checked in the Project "Application" Info that under the Code Signing Identity , it is set to iPhone Distribution : "Name".
Also have checked in the Target "Application" Info for the same thing. Then done a clean build and run but still having this error.

The simulator cannot get you a device token, (just in case you didn't know).
On the device, if you have jailbroken it, I am not able to get a token. You need to have an untainted phone.
The error you are getting is because you a selecting the wrong certificate.
Follow these instructions carefully
http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/
Your certificate could also have expired for push notifications, check that as well.

i solved it, The organiser window of XCode > Window > Organiser . In the Devices tab, when you click on a device that is connected, there is a console pane on the right. you can then use that to find out your device token if "get-task-allow" is not allowed.

Related

Selecting "Enable Entitlements" for iCloud causes codesign error, even with correct distribution provisioning profile

I have updated and rebuilt my app with a new provision profile that was configured with "Enable for iCloud" checkbox selected in the provision portal.
Next, in XCode, for the app project, I selected the box for "Entitlements" in Targets->Summary->Entitlements as shown below to support iCloud. However, as soon as I add this, I am unable to build the application as I get the dreaded
warning: Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate. (-19011)
The app builds successfully with NO codesign errors and installs onto hardware with the proper provisioning profile when the "Enable Entitlements" is unchecked. As soon as I check it, it gets the codesign error.
I also tried updating the entitlements file with ABCDEF.com.myapp (with my real iCloud ID and app id) for the com.apple.developer.ubiquity-container-identifiers value.
What am I doing wrong? Any help is greatly appreciated!
Btw, I wrote a blog post with a solution which could be helpful.
You may try to copy and paste the <dict> of key entitlements from your provisioning profile to your.entitlements (a plist) file.
iCloud Gotchas
Finally, I found the solution. It ended up being a Apple Provisioning Portal issue.
Even though I followed these steps:
1. Selected "Enable for iCloud" for the App ID
2. Created(regenerated) a new provision profile that was configured for the respective "Enable for iCloud" app
3. In XCode, for the app project, I selected the box for "Entitlements" in Targets->Summary->Entitlements as shown below to support iCloud.
The build error still persisted. So, I looked at the Prov Prof with an editor and the entitlements were NOT in there even though I just generated a new one.
What I found was after about 1 week, surprise!, if I generated the Prov. Profile now it had the entitlements in it! So, there was a delay before the generation of the PP's would pick up the iCloud entitlements. Also I filed this issue with Apple so they are aware of this strange delay.

Provisioning, certificate, error from debugger

EDIT: After trying many, many things over and over again I've decided to upgrade to xCode 4 and problems stopped. I don't know what was wrong so unfortunately this is my advice to the rest of you who are lost with the problem I had.
PS thank you all for your suggestions :)
Hi everyone,
I don't know why, but my app stopped compiling on my device after trying to enable push notifications. In debug mode with developer certificate it was running ok, but I was getting push notification related error in the console. After reading about this problem I realized I'll have to sign the code with Distribution certificate in order to really test the push notification. After "playing" with these things my app could not be deployed on the testing device anymore…
I am getting 2 errors over and over again:
1. The executable was signed with invalid entitlements
and when I solve this problem by changing the "code signing identity" to another developer certificate (admin) I get another one:
2. A valid provisioning profile for this executable was not found.
I tried all of the following:
- I logged with my team admin's pass and deleted /revoked certificates and profiles, recreated them and installed them on my computer. In keychain everything seems ok (certificates with keys) and in xCode Organiser (new profiles) also.
I cleaned targets several times
created Entitlements.plist with custom value "get-task-allow" unchecked
In Entitlements.plist I put my bundle identifier
I removed profiles from iphone device and tried again. It installs right provisioning profile
I restarted computer/xcode, iPhone several times
Then, when I saw that I'm going crazy I've decided to try to start another application just to see if this one can be run.
Guess what… It can't. I get the same two errors as above.
I'll explain how I recreated things in developer portal step by step so that you can see If I'm missing something. Just have in mind that we are using 2 developer tools accounts (team admin (A), team member (B)). I'm saying this because I might have done something wrong while recreating certificates and profiles…
REMOVING OLD SETTINGS
1 deleted certificates (dev and distribution) and private keys from keychain.
2 removed all provisioning profiles from xCode Organiser.
3 In developer portal (as Admin) I revoked its Development certificate and then removed Distribution certificate
4 In devices I removed my iPhone device
5 I removed all Development provisioning profiles. The Distribution ones cannot be removed???
6 Then I logged into Team Member's account and revoked development Certificate
CREATING NEW CERTIFICATE; PROFILE...
1 In keychain assistant I created new CSR and uploaded it, admin approved it and I downloaded it along with WWDR intermediate certificate. Drag and dropped them into keychain - login / category - certificates
2 I added my device name/identifier
3 In PROVISIONING/DEVELOPMENT I created new provisioning profile. I added my developer, all devices, and app ID.
4 Then from my team member account I downloaded it, double clicked it and that was it.
5 In xCode Project info I set code sign to developer certificate, and I ran and built with Device / Debug. I get build succeeded and error: The executable was signed with invalid entitlements
TAPPING IN THE DARK:
//I create enitlements.plist and run and I get: Error from debugger: The program being debugged is not being run.
//Then I add get-task-allow = false and I get the: The executable was signed with invalid entitlements.
//If I change it to true then I get: Error from debugger
//Then I add my app Id to Entitlements as a pure string. Nothing changes here :( - either
Thank you very, very much for even reading my post.
Hope I'll solve this before going nuts…
Best regards,
Luka
For that you have import private key(.p12) of mac of your team leader then it will work.I face the same problem it works then only if you will have private of that mac from where the certificate made.Hope so that it will help.
I just spent a few hours with this exact error, the steps i took to resolve it were:
check that app ID has push enabled
create a new provisioning profile
delete all other profiles in xcode and on the device and use new profile
(building and installing on device without error)
create entitlements.plist and add in get-task-allow, change type to boolean, set to true
(now getting entitlement error)
So after much googling i found a blog post about how images can affect this so i checked and noticed we were in the middle of changing the app icon and currently didn't have one set. So I threw in a older app icon and it just started building like magic and giving me the device token.

iOS codesign error

I continuously get the following warning when I build my iPhone application:
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
But my application still runs. Why is this occurring? Can someone help? I updated my application and the App Store approved it, but now it crashes everytime anyone runs it (after installing the update) and I have no idea why. And now, I can't even get this warning to go away.
Here's my todo list when I've run across this.
1) Clean all targets, exit Xcode, then go drag the build folder from your project to the trash.
2) Do the Get Info on your project, make sure the Code Signing Entitlements and Code Signing Identity are selected correctly. Do the same for your Targets.
3) Login to the iOS Provisioning Portal and make sure the Distribution certificate has not expired. Also check the Distribution Provisioning Profile and make sure it is Active. Make sure the Certificate is properly in your Keychain and the Distribution profile is in Xcode Organizer (if you have multiple of the same one, delete all but the correct one and redo step #2).
4) Look at your Build Results on the failure and identify which profile it is actually using and make sure it is the right one.
It seems that this is a bug in Xcode, I have read somewhere people reporting that warning after upgrading it. I have the same problem, I can compile and run the App, I have already released the App to the AppStore, but I just can't get rid of that annoying warning.
I think you can have a try to reset Keychain, before I encounter a problem that show my certificate was expired or invalid and I can not run with mobile, then I reset Keychain, then it worked well.

A valid provisioning profile for this executable was not found for debug mode

I am getting this error while I am trying to debug my app on device.
I created development provisioning profile as it is mentioned at the developer portal. My development device is selected in the profile and I am selecting the correct profile from Target's code signing identity menu. I recreated provisioning profile for several times and also removed and reinstalled it and recreated the project but I am getting that whenever I try to debug on device.
Btw, the adhoc distribution provision profile works.
I spent my whole day to find out a solution but nothing. Anyone have a solution?
It could be because your iphone is not recognized by the provisioning portal.
Solution:
In Xcode, Goto --> Build --> clean all targets.
In "Groups & Files" -->Target --> expand it --> right click your app and select Clean "your app"
Goto->Window-->Organizer
In the Devices tab on the left, select your iphone
In the Provisioning section of the selected iphone delete all the current profiles (if any)
Unplug your iPhone and replug it in.
Goto->Window-->Organizer-->right click your iPhone -->Add device to provisioning portal
Now make sure you have selected the appropriate code signing identity in edit project settings -> build --> code signing
Build and run.
In Xcode 10, I solved this by switching the project's build system from "new build system" to "legacy build system" (File -> project Settings).
I had the same problem. Everything was ok:
the device was registered in IOS Provisioning Portal; the certificate was downloaded and the Development Provisioning Profiles for my app was downloaded.
So the solution!!!
Target> Get Info
Select Configuration to Release (here's the devil)
In code signing, Code Signing Identity check iPhone Developer. Close.
On Target chose Clean Target and then Run the app.
Good Luck.
In my case this was because there where a couple of versions of the developer certificate in the keychain.
Deleting the iPhone Developer cert from both My Certificates and Certificates and then downloading the latest one from the dev centre and installing that (double click on the .cer file)
sorted my problem
Finally i could solve the problem. One of my colleagues has revoked the developer certificate at iOS Provisioning Portal for his test apps. for fixing; i removed the existing developer certificate at my keychain, requested a new certificate with the existing private key, revoked the certificate from provisioning portal and submitted the newly requested certificate.then i downloaded and installed it.
now i can debug my app on my device :)
This caught me out because someone had changed the "Run" configuration's "Build Configuration" setting to "Release" (under "Product" > "Edit Scheme.." > "Run *.app").
This is normally set to "Debug" and hence it was NOT using the developer certificate and provisioning profile that I was expecting, it was using the distribution certificates instead.
In addition to this I found that if you look in the Console Log for the device (via Organiser), there may be an error code that better indicates your problem. For example I had...
Mon Sep 5 09:39:56 unknown installd[304] <Error>: profile not valid: 0xe8008012
I then googled "0xe8008012" and got the following page which indicates a "0xE8008012 - The UUID of the device does not match any in the Provisioning Profile being loaded" error.
MobileInstallation
Xcode->Click your app -> TARGETS -> click the app-> Build Setting-> Code Signing : Make sure that both Debug and Any iOS SDK are set to iPhone Development
Xcode -> Product -> Scheme -> Edit Scheme: Make sure Build Configuration is set to Debug.
I had the same issue with Xcode 10.0 beta 5 (10L221o) and a device running iOS 12.0 (16A5345f) - that's also beta.
After installing the app alert titled "App installation failed" showed up, "A valid provisioning profile for this executable was not found.".
I got rid of it by going to: ~/Library/MobileDevice/Provisioning Profiles and finding the certificate Xcode was trying to use. Then in the "Devices and Simulators" window in Xcode, I right clicked on my device, choose "Show Provisioning Profiles" and with a plus button added the provisioning profile to the device there.
I don't remember when I've done it last time, it's been years. I guess that Xcode normally does it for us but for some reason, it fails when we see that message.
In my case this problem occurred because another provisioning profile was selected for the unit tests. Just took me hours to find this ...
With Xcode 6 and a new device:
Press cmd + shift + 2 to open devices.
Press the "register device" button. If there is no such button (like in the screenshot) go to developer.apple.com and add it manually. Copy the Identifier into the field.
Go to Xcode -> Preferences -> Accounts -> Doubleclick on your account -> Press the little refresh button on bottom left to refresh the profiles
Go to Code Signing and set the new profiles.
We can try this: This has solved my problem . You need to reset the profile for which your device id has been added into your member area of Apple.com . .
Assuming you have your development and distribution certificate installed correctly:
Under Project your main code signing identity should be the developer profile for that app.
Under Targets your main code signing identity should be the distribution profile for that app, except that you should change Debug > Any iOS SDK to your Development profile... and make sure Release > Any iOS SDK is your Distribution profile. This should build and run on your provisioned phone and should archive without any codesign warnings.
Only thing that worked for me when my phone crashed and I had to restore it from a previous iTunes image.
This solution worked for me
Go to Xcode --> Preferences --> Account.
In the provisioning profiles section, right click and open with finder.
Delete all provisioning profiles from the provisioning profile folder.
Finally, go back to Xcode and click the refresh button.
I hope that helps!
I had the same problem. what I did is:
1. clean the target
2. exit the xcode
3. restart xcode
4. rebuild.
and it worked.
Another cause (verified):
Apple has a major bug in Xcode going back to version 3.x, where it magically overwrites the OS X keychain with a fake keychain from inside Xcode, re-installing certs (and private keys!) that you already deleted
...so, if you have "new cert" installed, and nothing else, Xcode will sometimes get into an infinite loop where it will keep ALSO installing "old cert" (that doesn't exist anywhere except inside XCode!).
...and because of ANOTHER bug in Xcode (unfixed for 3+ years now...), Xcode sometimes automatically selects the "oldest cert I can find" (whcih, by definition, is incorrect - I think someone at Apple got mixed up between "oldest" and "newest" :( )
...and EVEN THOUGH you've selected the correct provisioning profile, Xcode sends the "old" provisioning profile to the device, then signs with the "new" profile, causing this error
Solution: you have to un-FUBAR Xcode's FUBAR of your Keychain.
This is harder than it sounds (there are multiple SO posts on this topic) - it involves multiple reboots of your machine, deleting the key every time.
Eventually, Xcode gives up on corrupting your OS, and accepts the reality you present it with :).
Changing the provisioning profile to automatic then running prompted Xcode to "fix" the issue. I then changed back to my original provisioning profile and everything worked fine.
In my case a valid provisioning file is because I didn't add the device to the very provisioning file.
Had the same problem. My solution was very easy. I checked If I have my device's UDID in developer.apple.com and it was absent. After I added it, it starts working. It is very annoying that Apple developers give error "A valid provisioning profile for this executable was not found" instead of "UDID is not found". Actually I mentioned it first in XCode 6...
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting -> General -> Date & Time -> set time automatically
If it does not work set time automatically of both mac & iPhone, will work fine.
Remove certificate, profiles and recreate it. Install it. Thats the best soultion.
In my experience this problem happens if you try to build on a device that is not registered in your developer center or is not enabled inside provisioning profile that you are using.
1) Add the device to the developer center.
In XCode 5 you'll still find a button "add to member center" inside the Organizer window.
In XCode 6 i suggest to copy the device ID and manually add it to the device section of your member center.
2) Edit the provisioning profile you're using to include the device you have just added. Save and synchronize provisioning profiles from XCode.
Clean, and it is on.
One of the cause could be your "project => Build Settings => Signing => Development Team" is different from your "target => Build Settings => Signing => Development Team", just make them same
After select auto manager signing
You may still need to check the selection in settings. Sometime, it's not correct there.
I had a certificate that expired (which generated the error).
Step 1. Go to developer.apple.com, login, and go to IOS provisioning portal
Step 2. Go to certificates (which is now empty), and follow the instructions listed to create a new certificate (open keychain on your computer, create a signing request, save it to disk, upload it to apple)
Step 3. Download and install the files created by apple to your keychain
Step 4. Problem: all of your previous provisioning profiles were associated with your OLD certificate, so you need to go back to developer.apple.com->IOS provising portal-> provisioning profiles and 'modify' each profile you care about. You will see that your identity is no longer assicated with the profile, so just click the check box
Step 5. Download all the profiles you changed
Step 6. Plugin your phone and drag and drop the .mobileprovision file onto xcode icon in the dock bar to install them on the device
I saw this problem because I had obtained a new Mac, and was still using my old Computer's certificate. I had created a new certificate for the new Mac, but had both certificates in my keychain.
In the Organizer, the profile warned that "XCode could not find a valid private-key/certificate pair for this profile in your keychain" even though the old certificate existed in my Keychain.
The solution was to delete the old certificate from my Keychain and delete/revoke of all the profiles which used this old certificate. Then create a new profile with the new certificate and use this.
Hope this helps!
Bringing an app up from Xcode 3 to 4.3 I found the Bundle name and Bundle identifier had to be set to match the AppId.
If all else fails, give that a whirl.
I faced same issue there may some other reasons too:
While testing i set my date to some future date and profile got expired. As result this issue was generated.
But i solved by setting date of iphone to current date as a result profile was not expired.
I'm compiling my app in Adobe Air for iOS, not Xcode. I was trying to copy the .ipa using iTunes, and got a mysterious "Error installing app" message. It wasn't until I used the iPhone Configuration Utility (iCU) that I got the real error message.
The problem was that I was compiling the app with a provisioning profile for ad hoc distribution and a certificate for development. I didn't understand that there are 2 types of certificates, and 2 types of provisioning profiles. There's one of each for development and one for distribution. If they don't match... then you get that error message. It's obvious once you understand it...
The solution was to download the distribution certificate (.cer), double click to open in Keychain, and export that as P12 from KC directly. Then use that P12 distribution certificate in the publish settings (Flash IDE or Flash builder), and also use the provisioning profile used for ad hoc distribution (.mobileprovision). Then finally install the provisioning profile and the .ipa file using the iPhone Configuration Utility.
That did it for me.
In my case my provisioning profile was invalid because apple has changed some of its terms and conditions. To fix problem I had to
delete previous profile.
I had to accept terms and condition from this website of apple.
Click Your app from Xcode Under Targets. (Under project.) Here you see Summary info, build settings, Build phases, build rules.
Okay go to Build Settings. Go down to Code Signing.
You see you have two fields Debug and Release. You have two profiles to choose from in each of those fields, Distributing and developing.
Let distributing be the one from the Release field. Let Developing be the one from the Debug field.
Doing this solved this problem, and let that error message go away. Now I can run my application fine.

Why do I get a "security policy error" when launching my iPhone OS app?

I created an iPhone OS 2.2 app some time ago and recently installed the 3.1 SDK.
When I try to run my app on my (3.1) iPod Touch, the launch window says "Error from Debugger: Error launching remote program: security policy error."
Viewing the iPod Touch's Console (via the Console tab for my device in Xcode's Organizer) shows:
Wed Feb 3 23:29:17 unknown SpringBoard[24] <Warning>: Unable to launch com.blahblah.Blah_Blah because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
Wed Feb 3 23:29:17 unknown com.apple.debugserver-43[789] <Error>: error: unable to launch the application with CFBundleIdentifier 'com.blahblah.Blah_Blah' sbs_error = 9
I already sifted through a bunch of code-signing issues just to get it to build and deploy, so I think this might be something else.
After trying the above solution of deleting expired certs, I was still encountering this issue. Turned out I needed to launch the application manually once and accept the prompt asking if I really wanted to launch that application signed by that profile with that dev account. After accepting that, Xcode was able to successfully launch it subsequent times.
The solution for me was to delete all expired provisioning profiles on the device (even unrelated ones) Window -> Organizer - choose your device and under profiles delete any that have expired. Thanks to:
"security policy error" on iPhone and iPod Touch
The problem turned out to be spaces in the executable's filename (I think).
I had previously sorted out a similar problem with bundle identifiers by appending ":rfc1034identifier" to PRODUCT_NAME in my info.plist, but this is a little different.
I'm not sure how to set the executable name directly, but I eventually just changed the Product Name in the "Packaging" section on the "Build" tab for my Target to something that didn't have any spaces. Fixed!
I had the same problem when trying to run on my "newest" iPad after adding the device in XCode. Apparently this device was not in the list of devices for the development profile I was using.
Solution: go to iOS Provisioning Portal, select "Provisioning" on the left hand size, select the 'Development" tab on top and change in the applicable profile in the list on Edit/Modify
Then you can edit the settings for the Certificates to use and add the individual devices.
Then once you connect the device with the XCode organizer, the info on the device will sync automagically. You may then also want to remove the outdated profiles in the Organizer.
Problem solved.
Fixed this issue myself.
Go to Organiser Window
Select Provision Profiles from the left hand side
Press the refresh button in the bottom right of the window
punch in your AppleID and password
Feel free to recompile your app
My issue was I updated my profiles to add new devices but did not update the profile in XCode.