13
votes

Tonight I upgraded from Snow Leopard to Lion, and upgraded to Xcode 4.3.1 (iOS 5.1). And now when I try and run debug mode on my device (iPad) I get "A valid provisioning profile for this executable was not found". I have tried every suggestion in past posts on this issue. I have generated a new certificate. I have set my code signing to use the new certificate. I have updated the provisioning profile to use the new certificate. I have gone into the .pbxproj file and deleted all references to the provisioning profile. I have cleaned and closed Xcode a million times. No matter what I do, I still get the same error when trying to run on the device.

In Organizer, the provisioning profile shows up as "Valid profile" in my Library, but under the Provisioning Profiles listed for the device there are none listed. I have tried clicking the Add button and importing it manually - nothing happens. It doesn't show up. When I click on the device icon in Organizer is says "Provisioning No provisioning profiles". However when I go to my iOS Provisioning Portal online and click on the device, the provisioning profile shows up there as being associated to the device.

Any ideas? I am pulling my hair out here.

7
Did you check your Bundle Identifier?You have to give the identifier of your new Provisioning profile as your Bundle Identifier.Sree
The App ID associated to my provisioning profile is (Bundle Seed ID).(Bundle Identifier). And it matches the Bundle Identifier set in my info.plist file.Joel
Have you set the same Code Signing Identity in Build Settings for both the Project and the Target? Easiest is to use iPhone Developer, that makes it always match the right profile.ott--

7 Answers

10
votes

Do you by chance have two developer accounts with different sets of devices/apps? I encountered this situation (see what "iOS Team Provisioning" profile is matching "iPhone Developer"). The only way I have found to switches teams, so to speak, is to select your device and click "Add to Portal" and log in with the correct Apple ID.

6
votes

The solution that worked for me was:

-Deleted all references to provisioning profile in .pbxproj.
-Deleted all certificates in keychain.
-Imported my certificate to keychain.
-Created new provisioning profile and configured it in developer portal.
-Refreshed provisioning profiles in xcode organizer.
-Deleted the wildcard provisioning profile that xcode automatically adds.
-Went into code signing and selected the signing account associated to the correct provisioning profile.
-Plugged in a different iOS device (switched iPad with for fresh iPhone)
-Built for a new iOS device.

And it worked. Not sure which step was the magic one. I did not reinstall xcode.

5
votes

Make sure there is a valid private and public key generated for the profile. More importantly make sure the keys are stored in the right place in keychain.

They should be under login, not system or any other spot. This was causing and issue for me, and it took me a while to find the solution.

Hope this helps.

2
votes

I have seen this problem before, and my "standard" solution is

a) make a new dummy iOS project , using Xcode menu - file - new - project. Check code signing is your developer certificate. Compile and see if it can run on your iPhone/ipad hardware.

If a) fails, it is something with your certificates and keychain. Clear all and make new certificates

If b) works, it is something in the .xcodeproj file or build folder for your problem project. Remove all files and folders in build. Use your backup (sure you have a daily backup for your project!!!), and copy an "old" .xcodeproj file to your problem project. Use Xcode - project - clean, xcode - project - build as - testing , and hereafter "run".

Before trying above solution, make an extra backup.

good luck, and remember you are not the first having certificate problems.

0
votes

In my case the problem was not at all related to keys, certificates, provisioning profiles or any other of the reasons mentioned here and everywhere else. It turns out that some other developer in a different team borrowed the iPad we use and changed the device's date to one year in the future! After I set the correct Date and Time and ran the application on the device everything worked just fine.

Unfortunately Xcode didn't warn me about this, and it was until I needed to fix another unrelated problem that Instruments informed me of this situation about the wrong date on the device.

0
votes

Simply check "Code Signing" section in "Build Settings". If you previosly build your app for appstore publication maybe you forgot change from distribution profile to development profile.

0
votes

If you are on Xcode 6, and running into this problem when adding a new device (iPhone 5/6), you can follow the steps here:
https://stackguides.com/questions/22993092/a-valid-provisioning-profile-for-this-executable-was-not-found-error-when-tryi/26153171#26153171