Xcode5 "No matching provisioning profiles found issue" (but good at xcode4) - xcode

Everything is OK on Xcode4.6. When I try to use Xcode5 dp6 to run app on devices. I got an error of "No matching provisioning profiles found issue". How can I resolve this issue?

Don't forget to change profile in Provision Profile sections:
Ideally you should see Automatic in Code Signing Identity after you choose provision profile you need. If you don't see any option that's mean you don't have private key for current provision profile.

What really confused me was that there are two different sets of build settings:
1) for the Project
2) for the Target
In the sidebar (top left) there is a blue icon that represents your project. Click that:
Then in the main panel to the right, in the top bar, just to the left of the word, "General," there is a small icon of your Project. Click that, and now select the Target in the pop-up menu that appears:
Once you've selected the Target, now the build settings for the target can be changed. They are different than the ones for the Project itself... weird! I'm not sure why there are build settings for the Project as a whole, that are different from the Target, since the Target's settings are what gets used during building. So why even have settings for the Project? Not sure.
But that's how you change them. This solved the issue for me: go into the Target (not the Project!) under Code Signing > Provisioning Profile > and change the settings to the proper profile. For a long time I was just changing them in the Project only, since I didn't know I was supposed to select the Target, and I kept having this issue. This fixes it!

Setting your provisioning profile moved. It confounded me for a while until I found it also.
Select your project file (to open target)
Click on the "Build Settings" tab
Scroll down to "Code Signing" and see the new "Provisioning Profile" section there.

OK - all answers provided above are correct to some extend, but did not resolve this issue for me. I'm using Xcode5.
There are lots of threads around this general error but from what I read this is a bug in Xcode dating back to 3.x versions that can randomly create conflicts with your Keychain.
I was able to resolve this by doing the following:
Open Xcode -> preferences -> Accounts: delete your developer account
Open Keychain: Select Keys, delete all iOS keys; Select My Certificates, delete all iPhone certificates
Navigate to '/Users//Library/MobileDevice/Provisioning Profiles', delete all files (this is where Xcode stores mobile profiles)
Open Xcode -> preferences -> Accounts: re-add your developer account
Navigate to Project properties, Target, General Tab and you should see the following
Click 'Revoke and Request' (I tried this, it may take a few min) or 'Import Developer Profile' (or download from Apple developer portal and import this way, should be faster..)
FINALLY: you can go over to Build Settings and set 'Provisioning Profile' and 'Signing Settings' as described by everyone here..
Doing this and only this resolved this error for me.

Here's a simpler solution that worked for me:
In XCode5, double-click on your app's target. This brings up the Info pane for the target. In the "Build Settings" section, check the "code signing" section for any old profiles and replace with the correct one. update the value of "code signing identity" and "provisioning profile"

Sometimes, especially after generating a new certificate or starting to use a new code signing identity, there seems to be no other way to fix this, other than doing some cleaning the .pbxproj file. This is probably a bug that will be fixed, so if you are reading this long after this post, maybe you should try some other solution.
There is an excellent post about this in the pixeldock blog:
http://www.pixeldock.com/blog/code-sign-error-provisioning-profile-cant-be-found/
In short, mostly quoting from that article, you need to:
Make sure you have fetched all your remote iTunes Connect certificates in xcode5 from Preferences, Accounts, (select your account), View Details, press refresh button. (Normally, I answer no when xcode asks if I want to create certficate signing requests, it's not necessary when you only want to download/refresh your certificates)
Close Xcode
Right click on your project’s .xcodeproj bundle to show it’s contents.
Open the .pbxproj file in a text editor of your choice (make a backup copy first if you feel paranoid)
Find all lines in that file that include the word PROVISIONING_PROFILE and delete them.
Open Xcode
Enter your target and select the provisioning profile that you want to use.
Build your project
Good luck!

In xcode5 from Preferences, Accounts, (select your account), View Details, press refresh button. then select Provision Profile in build settings.

In my case the "Fix Issue" button triggers a spinner for about 20 seconds and fixes nothing.
This works for me (iOS 7 iPhone 5, Xcode 5):
Xcode > Window > Organizer > Devices
Find the connected device(with a green dot) on the left pane.
Select "Provisioning Profiles"
On the right pane, there is a line with warning.
Delete this line.
Now go back to click the "Fix Issue" button and everything is fine - the app runs in the device as expected.

I have 2 targets in my project, Free and Paid.
My mistake was i was looking at my free target while trying to build the paid target, a stupid mistake but possible someone out there might learn from this as well.

I get the same question as you you can click here :
About the question in xcode5 "no matching provisioning profiles found"
(About xcode5 的no matching provisioning profiles found )
When I was fitting with iOS7,I get the warning like this:no matching provisioning profiles found.
the reason may be that your project is in other group.
Do like this:find the file named *.xcodeproj in your protect,show the content of it.
You will see three files:
project.pbxproj
project.xcworkspace
xcuserdata
open the first, search the uuid and delete the row.

All of drop down lists disappeared in Build Settings after running the Fix Issue in Xcode 5. Spent several days trying to figure out what was wrong with my provisioning profiles and code signing. Found a link Xcode 4 missing drop down lists in Build Settings and sure enough I needed to re-enabled "Show Values" under the Editor menu. Hopefully this helps anyone else in this predicament.
Also, I had to clear my derived data, clean the solution and quit and reopen Xcode into for the code signing identities to correctly appear. My distribution provisioning profiles where showing up as signed by my developer certificate which was incorrect.

I had the same error today, with XCode 6.1
What I found was that, no matter what I tried, I couldn't get XCode to stop complaining about this Provisioning Profile with a GUID as its name.
The solution was to search for this GUID in the .pbxproj file, which lives within the XCode .xcodeproj folder.
Just find the line containing your GUID:
PROVISIONING_PROFILE = "A9234343-.....34"
and change it to:
PROVISIONING_PROFILE = ""
One other thing to check: Your XCode PROJECT settings contain your Provisioning Profile & Code Signing settings, but, there is a second set under your project's "TARGETS" tab.
So, if XCode is complaining about a Provisioning Profile which isn't the one quoted in your project settings, then go have have a look at the settings shown under "TARGETS" in your XCode project.
(I wish someone had given me this advice, 4 painful hours ago..)

Related

Automatic signing is unable to resolve an issue with the "Project" target's entitlements [duplicate]

This question already has answers here:
Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements
(16 answers)
Closed 3 years ago.
I've literally checked every possible question in stack overflow that have been solved about the same problem.
I know that millions of questions exactly the same as mine have been asked, but I tried all the suggestions in the answers of those questions but Xcode is still giving me problems.
So as always the first error is:
Automatic signing is unable to resolve an issue with the "Project" target's entitlements.
The second error is of course:
Provisioning profile "iOS Team Provisioning Profile: com.badubadu.WeatherApp" doesn't include the application-identifier and keychain-access-groups entitlements.
What I've tried:
Switching the provisioning profile from Manual to Automatic and viceversa
Cleaning up the Provisioning Profiles inside the Library/MobileDevices and then restarting Xcode
Deleting the old app from the iDevice and trying to build it again
Turning on and off the Background Modes (I don't have push notifications and In-app purchases)
Restarting the computer and the phone (just in case it was that easy)
Tried to change the Bundle Identifier
Tried to create another team and select that one instead
Creating a Project.entitlement empty file
None of this worked anyways, and it's so annoying that until now I could've simply click build the app and it would have built it on my phone
Am I missing something?
Although this seems to be an issue with Apple, I've been able to find a temporary solution which has worked for me:
Open your project in Xcode.
Select your project from the project navigator and then select your target from the column.
Click on the General tab and under the Signing section, make sure "Automatically manage signing" is enabled.
Click on the Capabilities tab and turn On both the "App Groups" and "Keychain Sharing" settings. This might raise an "Automatic signing failed" popup error, just click cancel to make it go away.
This should generate a entitlements file for you named nameProject.entitlements in the project folder of your project navigator.
Move this entitlements file outside of the folder, just below your project file.
Select your target again and return to the Capabilities tab to turn Off both the "App Groups" and "Keychain Sharing" settings. This again might raise an "Automatic signing failed" popup error, just click cancel to make it go away.
Now select your project above the target and go to Building Settings tab.
Scroll down to the Code Signing Identity setting under the Signing header and select iOS Developer from each drop down.
Under the above Signing header, double click the text field beside the Code Signing Entitlements and enter the name of your entitlements file, nameProject.entitlements.
You should now no longer have the Automatic signing is unable to resolve an issue with the "Project" target's entitlements. error. Hopefully this helps!

The identity 'iPhone Developer' doesn't match any valid, non-expired certificate/private key pair

It never happened to me before, I already downloaded sample code before, but now im getting this error:
I saw some questions with this error, but they say to check your "code signing" and I dont see what is wrong there...
Please help, im freaking out
The error means provisioning profile doesn't exist So
Check the Bundle Identifier in the plist file .
Go to Codesign Identity and click on the dropdown menu and click on the matching Provisioning Profile ( Matching provisioning profile appears in Black color )
Since the problem deals with code signing, you just have to uncheck the "Code Sign Application" box on Summary Properties. It worked fine for me.
I am suffering the same problem. Most of the answers saying things like Bundle Identifier, provisioning profile, or crap like that.
If people know what those are, they won't come to internet, OK?
check this
http://www.techotopia.com/index.php/Testing_Apps_on_the_iPhone_–_Developer_Certificates_and_Provisioning_Profiles
it explains everything.
Possible fix (that worked for me) :
I changed the scheme "iOS Device" to "iPad 6.1 Simulator" or "iPhone 6.1 Simulator" then I rebuilt the project without this error.
I had the same error and I found this: How to make an IPA on XCode 4.6?
These steps work for me:
1. Go to /Applications.
Right click on XCode and select 'Show Package Contents'.
CopyContents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist to your desktop. (Make sure to actually copy and paste. No drag and drop)
Open it and under DefaultProperties set CODE_SIGNING_REQUIRED to NO.
Copy it back and replace the original file.
Restart XCode.
Open your project.
In Project Navigator select your project and open Build Settings section of your porject (and not any particular target)
Under Code Signing find Code Signing Identity and for both Debug and Release modes setAny iOS SKD to Don't Code Sign.
Now you should be able to build your project without any errors.

A valid provisioning profile for this executable was not found... (again)

I know this has been asked and answered multiple times but I'm tearing my hair out as none of the proposed solutions appears to work.
I receive the above error, despite having a valid provisioning profile which, as far as I can tell matches the bundle identifier:
I've followed the steps in various suggested solutions on this site, including deleting all existing certificates and starting again, as suggested here and here.
One thing I have noticed is that the profile doesn't show up in the code signing lists, either for target or project.
Can anyone offer any further suggestions?
This happened to me yesterday. What happened was that when I added the device Xcode included it in the wrong profile by default. This is easier to fix now that Apple has updated the provisioning portal:
Log in to developer.apple.com/ios and click Certificates, Identifiers & Profiles
Click devices and make sure that the device in question is listed
Click provisioning profiles > All and select the one you want to use
Click the edit button
You will see another devices list which also has a label which will probably say "3 of 4 devices selected" or something of that nature.
Check the select all box or scroll through the list and check the device. If your device was unchecked, this is your problem.
Click "Generate"
DON'T hit Download & Install – while this will work it's likely to screw up your project file if you've already installed the provisioning profile (see this question for more info).
Open Xcode, open the Organizer, switch to the Devices tab, and hit the Refresh button in the lower right corner. This will pull in the changes to the provisioning profile.
Now it should work.
If none of above stated works then check for your device date, make sure your device date doesn't exceed profile expiry date i.e. not set to far future.
+1 to banging my head against the wall for a day or two...
Also check this setting:
Build Settings -> Code Signing -> Provisioning Profile
After following the above steps, "Automatic" setting worked for me. ~kjm~
File > Workspace Settings > Set Build system to "Legacy Build System"
Xcode5 has broken this again (congratulations to Apple for failing to bother testing one of their buggiest bits of code. Again).
A new way to break/fix it:
If you have:
An old profile on your device (team profile, or non-team profile)
A new profile generated automatically on the App Store, by any copy of Xcode5, even if it's simply an update to the profile you already had
(NB: if any colleague adds themself to the profile, this triggers the above "change")
You use the new "Accounts" dialog to download profiles (NB: this is now REQUIRED by Apple for various situations - all other approaches, including manual download, appear to be unsupported. Even though the Apple Developer site TELLS YOU TO MANUALLY DOWNLOAD! Don't do it! It breaks Xcode5!)
Xcode5 will INCORRECTLY hide AND RENAME that profile in the drop-down selector in Build Settings
(I detest this drop-down. Some idiot at Apple keeps removing information from it, and someone else keeps adding it back, it flip-flops between Xcode point releases. WHY??!?!)
There is NO WAY you can select the correct profile - whatever you select, Xcode5 will use the wrong one
The solution is easy enough. The "Apple engineering are lazy" solution:
Go to Xcode5 -> Window -> Organizer -> Devices
Select your device
Select provisioning profiles
Delete everything relating to your current project and/or Team (even other projects, if necessary - they can all be downloaded later if still needed!)
Re-build.
You should get an error from Xcode5 that the profile doesn't exist. Even though you manually had seleted the profile that was ALREADY PRESENT on your machine (yep - that dropdown is buggy again. It lies about the profile it selects behind the scenes!)
In the profile selector, select the "real" profile
Build, run - success!
It happened to me when I accidentally left the build in release mode.
This can happen if your provisioning profile has expired. Another reason could be that you device date exceeds the expiry date of your provisioning profile. Please make sure that your device date is correct.
After spending the day I realized it was a simple change in Project Settings
File -> Project Settings... -> Build System -> Legacy Build System.
In a project setting, you will see Build System named drop down and in that drop down select Legacy Build System
Delete all certificates from the keychain of the account which you are trying to use provisioning profile
Delete Derived data
Clean the folder(cmd+sht+alt+k)
Clean the project(cmd+sht+k)
Build & Run
In my case it was just after a new Program Licence Agreement was released so we had to accept them and it was fine.
I had this error because I was testing my app to perform a certain action in the future. In other words, I had a different time on my test device, therefore, the certificate would not allow me to build.
Apparently, my certificate expires in a few days...
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 then set time automatically of both mac & iPhone, it may work fine.
I have spent about a week solving this problem. Most of the answers are sort of magic (no logical purposes for these algorithms) and they were not useful for me. I found this error in Xcode console:
ERROR ITMS-90174: "Missing Provisioning Profile - iOS Apps must contain a provisioning profile in a file named embedded.mobileprovision."
And found this answer solving this issue. The case is to switch Xcode Build system to the Legacy one.
I was deploying my Ionic app.
After wasting my half day I got this working.
Select Target > Edit Scheme > Select Run > Change Build Configuration to debug
I'm still not sure what the issue was but deleting all certificates and starting over (albeit twice) eventually solved it.
My best guess is that I've missed some small but important detail of the procedure. Unfortunately I can't be any more specific than that.
Make sure you have added your device - https://developer.apple.com/account/ios/device/create
Go into iTunes and click on the serial number and it'll change to the UDID - then right click to Copy the UDID and register it as your device.
You can then add that device to your provisioning profile.

Xcode build warning - Target Integrity - Provisioning profile is expiring only for the ProjectnameTests Target

All my apps that i've created so far do this. It does nothing to the app or being able to run it but it's just annoying always having that 1 warning.
I'm Using
Xcode 4.2
OSX 10.7.3
This is the actual warning:
-Target Integrity
Provisioning profile is expiring
Here's an image of it just so I don't have to try and explain. (Edited it and put 'Project' where my actual project name was for privacy)
Thanks for any help!
I had the same issue.
Worked out in the end it was Xcode warning about some expired profiles generally - not ones specifically linked to the current project.
To fix I went to Organizer/ Devices Tab and under Library select Provisioning Profiles
I had two profiles in the list that had expired - I didn't need them so I just right clicked and deleted them.
Warning then went away.
This is a bit different with Xcode 5 now when working with Teams ...
I go the same warning of an expiring old profile which didn't exist anymore - but it still did exist in the local Account setting for the connected team in Xcode (Xcode -> Preferences -> Accounts -> <team account in question> -> View Details). So I just did a refresh on these profiles, and yes, the warning was gone.
Unfortunately there are many more expired profiles for other apps in this team account which I just synched into my local Account setting (and I can't just remove them, as it's a client's account ..) - and now Xcode complains about all of them being expired. Guess you should be happy with what you got sometimes, it can get worse ...
I got the same warning on my old project today.
I tried this, and the warning went away.
At 'Build Settings' -> 'Code Signing Identity', Choose 'Automatic Profile selector'.
For Xcode 6 you need to:
go to the Preferences (Cmd + ,)
Accounts
choose your account
choose your team
Click view details
Choose provisioning profile from warning
right click (show in Finder)
remove from Finder
Now the warning should disappear or you will need to repeat above steps for another warning
I deleted all the provisioning profile from
cd ~/Library/MobileDevice/Provisioning\ Profiles/
and it's gone.
You can use this shell script the get the names of the provisioning profiles
It is a warning that your provisioning profile is about to expire and you should renew it.
You can do this at Apple's developer center website. If your developer profile program is also about to expire, you should renew it too.
I had to also restart Xcode after deleting the old profiles to get the warnings to go away.
I have the similar problem, Xcode say one provisioning profile is expiring.
Then I go to the developer.apple.com to delete the expiring provisioning profile, it fixed.
Hope can help you.
I had this problem because a provisioning profile I used was signed with a certificate that was revoked/expired. First, go to the member center and delete expired and invalid provisioning profiles. Regenerate the ones you need. To clean up Xcode, go to Preferences-> Accounts, select your account.
Click view details.
Right click any profile -> Show in finder. Delete all of them. Then go back to XCode, close details and reopen (to refresh) and re-download the ones you need (there'll be a download button for each profile).
Warning gone. Xcode might complain about code signing issues, but clicking "Resolve" automatically clears this up.
Then everything worked.

Entitlements are not valid

Recently, I have upgraded my iPhone SDK OS from version 2.2.1 to 3.0 version. After that, while building my application, I get an error that the provisioning profile has expired. So I created a new provisioning profile.
Then I made the distribution of my application with the provisioning profile. But I get an error in iTunes while synchronising my application into an iPhone device. The error message is "The application 'iGVA' was not installed on the iPhone because the entitlements are not valid."
I checked the code signing Entitlements contains the correct entitlement plist file.
How can this be solved?
Michael's answer above is spot on (or the link he points to is). Here are the steps I had to take to get it to work:
Have an ad-hoc certificate for which the device UDID is checked. Install that cert by dragging it onto the XCode icon.
On the project, create a distribution configuration and set your build params to the appropriate device | distribution. Right now, we build for Device 3.0 | Distribution.
My project did not include an Entitlements.plist file - I had to add it by selecting from the menu File | Add File | IPhone OS | Entitlements, and call the new file Entitlements.plist
The new plist file has only one row - set the value of that row to unchecked.
In the project build configuration, in the line for Code Signing Entitlements, enter the Entitlements.plist filename as the value.
In the Code Signing Identity, select the ad-hoc certificate identity (though I have found that you can also use your distribution certificate identity)
NOW BUILD :)
Deliver the resulting app file plus the ad-hoc cert to the person who gave you their UDID. Should work :).
An Entitlements.plist file is required for testers to install ad-hoc builds. The default iOS templates don't include one. In XCode 3.2.4 you create one like this:
From the menu, choose "File > New File…"
Under iOS Templates, there's a Code Signing section. Choose the certificate icon named Entitlements. Name the file "Entitlements.plist"
Select Entitlements.plist in your source tree.
Choose "View > Property List Type > iPhone Entitlements Plist"
Add a new key to the property list (select the top line, press return)
The item will probably be named "Can be debugged". If not, choose that from the available options. This is equivalent to "get-task-allow".
If you don't yet have one, create an 'ad-hoc' build profile:
Select your target in the source tree.
From the menu, choose "File > Get Info"
In the inspector. select the "Build" tab.
Under 'Configuration', choose "Edit Configurations…'
Select your 'Release' configuration, click 'Duplicate' at the bottom of the screen.
Rename the new configuration "Ad-Hoc Distribution"
Now you've created an Entitlements.plist, you need to add it to your build settings.
Select your target in the source tree.
From the menu, choose "File > Get Info"
In the inspector. select the "Build" tab.
Make sure the configuration selector is set to "Ad-Hoc Distribution"
In the "Code Signing" group, change the value of "Code Signing Entitlements" to "Entitlements.plist" - XCode may have put in a relative path for you. If so, change it.
Note - you'll have errors installing the app on your own device if you build & run with "Code Signing Entitlements" set for other build configurations.
Finally, check that the Entitlements.plist has been added to your target.
Select Entitlements.plist in the source tree.
From the menu, choose "File > Get Info".
Select the "Targets" tab.
Make sure the checkbox next to your target is checked.
You should now be able to distribute your ad-hoc builds without this error.
Most of this was gleaned from Apple's Managing Application Entitlements Guide, the rest by trial & error.
I got bit by this as well and found the answer in Ad-Hoc Apps and Entitlements.
You may need to make sure the path to your Entitlements.plist file is entered in your project settings under "Code Signing Entitlements".
I was getting crazy over this. Finally, I guess I got it. In project settings, I was setting entitlements and code signing stuff properly in the correct Adhoc configuration. However, although all seemed OK there, when I checked "Project -> Edit Active Target" my code signing entity was still stuck at "iPhone Developer".
After switching that to the correct "iPhone Distribution" and recompiled, Xcode asked me to allow code signing for the first time. And it all compiled and is transferred to my phone now!
I hope that helps. I seriously believe this problem is a bug or defect on Apple's side. I lost several hours for a simple thing, thanks to their undocumented IDE...
For record's sake, as all these wonderful answers didn't help me, I thought I'd share my Entitlements glitch.
So yes, I added UDIDs, got the provisioning, verified on the phone, in build settings, etc.
My glitch (thanks http://www.musicalgeometry.com/?p=1237) was that the Ad Hoc scheme was set as Ad Hoc configuration only for the Run settings.
For archive settings it was still pointing to the old Release configuration.
(These settings are the left side tabs in the edit scheme window.)
If I save someone my frustration - I've done my bit.
Code signing entitlements are no longer necessary for Ad Hoc builds in Xcode 4 - see details notes in Apple Technical Note TN2250
You also need to make sure that you have an unexpired provisioning profile, which foiled me on this one for a while (Ad Hoc provisioning profiles seem to expire after a year). Error message is the same, but it has nothing to do with not having a valid Entitlements.plist file.
Be sure that when you 'Build and Archive' that you are building for 'Device' and your configuration is not 'Debug'. It will seem to create the archive correctly, but will fail upon installing the .ipa the device if you are set to a Debug profile when you do the 'Build and Archive'.
This problem might not have anything to do with the Entitlements plist per se. I have two iPod Touches I use to test with. When I went to sync the apps with them, one worked perfectly, but for the other I got the 'entitlements are not valid' error. As it turns out, one device (the one that worked) had the mobile provision file on it, while the other one did not. This was an obvious oversight on my part. However, what threw me was I never explicitly added the provision file to the first device either. Not sure how it got onto that device (I'm still new at this - lol) - in the past I always just dragged it into the Organizer with the device attached, but I didn't do that this time.
So the provisioning profile and xcode were all set up perfectly with the correct IDs, etc. but the app still failed to sync. Obviously if the device isn't properly provisioned, you will get the error. Would be nice if the error was more helpful in this case.
I had this in XCode 4. I tried cleaning, deleting and recreating the entitlements file but still no joy. Then I changed the Value for "Can be debugged" from YES to NO .. and it worked. Anyway it seems to work fine now, I hope this helps!
This happened to me as well, and the other answers did not solve it for me.
After spending half a day building, installing, cleaning, clicking to no avail - I finally erased Entitlements.plist from the box under Code Signing Entitlements, saved, and typed it in again - voila! It worked again! I never touched the actual Entitlements file, just the setting.
I had this same problem, using Xcode 4. It turned out to be caused by a wrong selection for Identity in the "Share..." dialog in the (Archives section of the) Organizer.
The correct selection (for me) is: "Don't Re-sign".
I had this issue as well. As it turned out, sure I had edited a configuration to support ad hoc, and sure I was building using the distribution configuration. BUT. I hadn't edited the distribution configuration's properties, but the release's instead (I thought I was editing the distribution).
This might not be it. But even though you're certain, double check you're using the correct configuration, and that this configuration is adjusted properly.
From the docs:
Building an app for Ad Hoc
distribution is similar to building an
app for App Store distribution, with
an exception of two additional steps.
First, you need to create an Ad Hoc
Distribution Provisioning profile and
add the UDIDs of the iOS devices that
you want to distribute to using the
iPhone Developer Program Provisioning
Portal. Second, you need to create a
code-signing Entitlements file. For
information about how to create an
Entitlements file read the Managing
Application Entitlements section of
the iOS Development Guide.
Managing Application Entitlements
iOS provides access to special
resources and capabilities—such as
whether your application can be
debugged—through properties called
entitlements. To specify entitlement
information in your application, you
add an entitlement property-list file
containing entitlement definitions
(key/value pairs) to your project.
When you build your application, Xcode
copies the file to the generated
application bundle.
To add an entitlements property-list
file to your project:
In the Groups & Files list, select the
Resources group. Choose File > New
File. Choose the iOS > Code Signing >
Entitlements template. Name the file
Entitlements.plist. (You can use any
name; just ensure it matches the value
of the Code Signing Entitlements build
setting, as explained later in this
section.) Set the type of the
property-list file to iPhone
Entitlements. With the file selected
in the text editor, choose View >
Property List Type > iPhone
Entitlements plist.
Add your entitlement entries to the
file. For each entitlement property
you need to define:
Click the Add Child or Add Sibling
buttons to the right of the selected
row. The Add Child button has three
lines depicting a hierarchy, the Add
Sibling button has a plus (+) sign on
it. Choose the entitlement property
from the pop-up menu that appears. If
the entitlement you need to add
doesn’t appear in the menu, choose
View > Property List Type > Default
for File Type. Then enter the
entitlement-key name and type.
Enter the value for the property. Set
the Code Signing Entitlements build
setting for the target to the name of
the newly added entitlements
property-list file.
Once you
have created your Entitlements file
and added it to your Code Signing
Entitlements build setting, open the
Entitlements file and add or edit the
get-task-allow key and set it to
false.
In addition to compressing your .app
bundle to distribute your Ad Hoc build
to testers, etc. it is recommended
that you also compress the
provisioning profile before
distributing because certain email
clients and servers may corrupt the
provisioning profile.
For information about Ad Hoc
distribution please read the
Publishing Applications for Testing
section in the iOS Development Guide.
I just found another circumstance that causes this problem. You have to make sure you include the correct provisioning profile. I have an application that has both an iPhone and an iPod version, and an iPad version built from the same project. I apparently sent out the iPad ad hoc profile with the iPad version of the application, and it doesn't work. Worse, I installed the correct profile locally with Xcode, so everything works correctly on my machine.
I experienced a problem whenever I added a new device in the device list, and then made the new profiles by selecting the new devices and drag them to Xcode and prepare the build.
The moment I use that build for device installation I get the error
ENTITLEMENTS ARE NOT VALID
I tried to resolve it by all the ways I could think of but nothing positive came out. Anyhow, I have to make the new App-ID or have to repeat the whole process of creating profiles. Then I can install the build on the device.
make shure to select the Signing Identity in the TARGETS ;)

Resources