Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain - iphone

How do you fix this XCode error :
Code Sign error: The identity 'iPhone Developer' doesn't match any
valid certificate/private key pair in the default keychain

This happens if you forgot to change your build settings to Simulator. Unless you want to build to a device, in which case you should see the other answers.

I 'tripped' across my solution after 2 days...XCODE 4.0
I've just upgraded to XCode 4.0 and this code signing issue has been a stunning frustrastion. And I've been doing this for over a year various versions...so if you are having problems, you are not alone.
I have recertified, reprovisioned, drag and dropped, manually edit the project file, deleted PROVISIIONING paths, stopped/started XCODE, stopped started keychain, checked spelling, checked bundle ID's, check my birth certificate, the phase of the moon, and taught my dog morse code...none of it worked!!!!
--bottom line---
Goto Targets... Build Settings tab
Go to the Code Signing identity block
Check Debug AND Distribution have the same code signing information
..in my case "IPhone Distribution:, dont let DEBUG be blank or not filled in.
If the Debug mode was not the same, it failed the Distribution mode as well...go figure. Hope that helps someone...
Figure: This shows how to find the relevant settings in XCode 4.5.

Check if you are building for device instead of simulator. Go to Xcode menu 'Project' -> 'Set Active SDK' change from 'Device' to 'Simulator'
Under Xcode 4.1
Check your build settings for the project and your targets. For each check under 'Code Signing' check 'Code Signing Identity' and change over to 'Don't Code Sign'

I had the same problem. I'm very new to iphone development and it was my first time trying to load my program onto my iphone. The message is correct, you need to create a certificate in the keychain. The best walkthrough is here:
http://developer.apple.com/ios/manage/overview/index.action
You of course need to have a developer account (need to have paid the $100 yearly fee).
I hope this helps.

I had the same problem. I was very new to iPhone development and it was my first time trying to submit my app to App-store...
Check the following :
1. Check that your current "Bundle Identifier" is same as your current "Provisioning Profile" name in "Code Signing Identity".
2. In "Code Signing identity block" - Check Debug AND Distribution have the same "Code Signing Information". Try to keep the "Code Signing Information" same in all the Blocks.
3. Try to Download the "Provisioning Profile" again and double click on the profile. Then use that newly downloaded profile in your "Code Signing Identity".
4. Try to Download the "Certificate" again from the "developer.apple.com" and double click on the certificate. (It worked in my case)
Then "Clean" the project and click on "Build for Archive".
Hope your code will be archived perfectly.

This usually happens to me when I forget to change the company to match mine.
Select the target under Groups & Files
Click the Get Info button
Choose the Properties tab
Under Identifier, make sure it says com.YOURREALCOMPANYNAME.APPNAME
When you create a new app, it usually says, "com.yourcompany". Change it to whatever you registered with, in my case com.DavidKanarek

In XCode 4.0 main workspace, at the top left side & just after the "Stop Button", there is scheme selector, click on it and change your scheme to IPhone Simulator. That's it

When I had this problem, the issue was I did not have the private key necessary for the developer certificate to be valid.
The solution was:
Have the developer who created the certificate export their private
key matching the iOS developer public key. see
http://developer.apple.com/ios/manage/certificates/team/howto.action
Open this file (Certificates.p12) on your machine (with KeyChain),
and enter the password the other developer used when exporting. It
is now imported into your KeyChain.
Now connect iOS device and rebuild targeting the iOS device.

In my case, I didnt have the Apple Root certificate. It can be found here:
http://www.apple.com/certificateauthority/

if your certificate is not valid, it will have a red "x" and state the reason why. Generally the reason is "This certificate has expired" or "This certificate was signed by an unknown authority.
to solve this you need to do the following step.
If your certificate has expired, renew it at the iPhone Portal, download it, and double-click it to add it to your Keychain.
If it's "signed by an unknown authority", download the "Apple Worldwide Developer Relations" certificate from the Certificates section of the iPhone Developer portal and double-click it to add it to your Keychain.
If your certificate was revoked, delete the certificate from your Keychain, then follow the "Obtaining your iPhone Development Certificate" or "Obtaining your iPhone Distribution Certificate" section in the iPhone Developer Program Portal User Guide to generate a new certificate.
Make sure you create a backup of your private key. The steps for doing this are described in the iPhone Developer Program Portal User Guide, under "Saving your Private Key and Transferring to other Systems".
If you have the iPhone Developer (or iPhone Distribution) certificate and its associated private key, the Apple WWDR Intermediate certificate is installed, and your certificate is valid, confirm that Online Certificate Status Protocol (OCSP) and Certificate Revocation List (CRL) are set to "Off" in Keychain Access > Preferences > Certificates.
if you still getting problem then contact support apple community.

if you are just using the simulator and just upgraded then this solved the issue for me:
go to menu->project-edit project setting.
find code signing section (you can type 'code' in the quick search)
in the code signing identity select 'any sdk' and set the value to 'Don't Code Sign'

I just ran into this problem myself.
The fix I come out with was to go to the organizer, click on the "provisioning profiles" tab, and press refresh in the low corner.
You ll be asked to give your itunes connect password , just follow the instruction.
Hope it helps

Related

Problems when trying to submit iphone app

I'm a fairly new developer.
When I try to submit my iphone app with xcode, I've got error as follows;
Code Sign error: The identity 'iPhone Distribution' doesn't match any valid, non-expired certificate/private key pair in the default keychain
After searching, I found out that I have to create a Distribution Provisioning Profile.
However, my distribution provisioning profile doesn't work, even though my Development Provisioning Profile works perfectly.
Could someone please help me with this problem?
I'm stuck all day...
and please forgive me that my English is not great.
Thank you in advance.
Have you installed you distribution certificate (not the distribution profile) into KeyChain Access?
this link should help you, it explains how to build for distribution.
If not then you should consider going into iOS provisionning portal and recreate your certificate.
I hope your project run on device based on the developer profile.
before your prepare the submission.just follow these things,
create Distribution profile in developer.apple.com--> iOs provisioning portal.Download and install into your system and iosdevice.
2.Then go to your project --> info Press + button above the comment-line build use.select any one of the that duplicate. and then rename that as "Distribution"
then select your project-->build settings and target--> build settings set the code sing as your distribution profile.
this is possible only to build.
then select your products section. right click on it select show in finder option and zip your .app file.
this file has to be use after your finish into the itunesconnect.apple.com ---> mange your applications selection.
go to the application loader--> select your .app zip file
this for submission of app store.

iPhone developer doesn't match any valid certificate (Xcode)

Hi I've kind of been cornered by apple here, I submitted a technical support query, one of the free ones thats comes free when you pay into the developer program only to be told that they won't be in the office until after Thanksgiving, a problem I overlooked as I am from Ireland. I really need help on this as I've tried looking in forums and I've tried solutions that were given for similar problems but I still can't crack it.
The screenshot images can be seen on this page..
http://www.heffernanwebservices.ie/blank.html
Here it goes...
DESCRIPTION OF PROBLEM On trying to build my project "Mulligan IRL" in xcode i get the following error " Code Sign error: The identity 'iPhone Developer: Cian Heffernan (8ELM27DL8F)' doesn't match any valid certificate/private key pair in the default keychain"
[Screenshot 1]
When I navigate to code signing in the build settings of the project i can see that when I click code signing identity for iphone developer or iphone distribution it has "(no profiles currently match) beside them. I then headed to the keychain access window in utilities and look in certificates and find that both the developer and distribution certificates will not expire until next August and November. Next I headed to the organizer in xcode. I see in provisioning profiles I have 8 profiles there! I don't know why I have so many.(2nd attachment)
[Screenshot 2]
As you can see ONE of the iOS team provisioning profiles will expire in 11days so I just tried to renew that. When I try this I get an error:(3rd attachment)
[Screenshot 3]
I then head to the provisioning portal to see why it wasn't found but I can see the profile. (4th attachment)
[Screenshot 4]
I have no idea why I am getting this error. I would appreciate any help on the matter.
For certificate to be valid it needs to be associated in your Keychain with a private key. Find the "iPhone Developer..." certificate in your Keychain and see if it's got a private key associated with it.
This can occur when you develop on two or more computers. You need to export the certificate+private key pair from the computer where you generated the private key first. Then import it onto all computers you do development on.
See Apple's Transferring Your Identities for more detailed info.
This could be caused by not having the private key associated with your certificate in your keychain. You can verify this by going to Keychain Access and choosing "Certificates" from the "Category" area at the bottom left. If your developer certificate does not appear when filtering that way, you are missing the private key for it.
If this is the case, you'll have to add your private key to the keychain, or else just reject and re-issue your development certificate with a new private key (you can find steps for this in the provisioning portal.)
a useful link from Apple about the submission process. hope it helps
I was using AppCode, but for me simply adding a new Keychain via Keychain Access called iPhone Developer allowed me to start building in AppCode.
Apple has a great article regarding Certificates and Provisioning-Profiles,
with excellent troubleshooting:
iOS Code Signing Troubleshooting
The most useful part I found was regarding cleanup of old provisioning-profiles from Xcode:
"Keep Your Profile Library Clean
...You need to manually remove provisioning profiles you are not using,
otherwise, Xcode will reimport potentially old or duplicate certificates into the keychain
and that can cause build errors."
And as a weapon of last resort, you can use this procedure:
How do I delete/revoke my certificates and start over fresh?

iPhone -- renew team provisioning profile

In the provisioning portal, the "renew" button for my team provisioning profile is grayed out. And said profile is expired.
How can I renew it?
EDIT: I found the "automatic device provisioning" checkbox and "refresh" button in the organizer in Xcode. But when I select the team profile, check the checkbox, and push the refresh button, I get this message:
An unexpected error occurred. Please try again. If the problem persists, please contact Apple Developer Support (http://developer.apple.com/support).
I suppose I can go to support, but it would still be better to figure out what the problem is without involving them.
I had the same "unexpected error" issue with the Team Provisioning Profile when it expired. I fixed it by deleting it in the Xcode Organizer AND in the ADC Provisioning Portal, then hitting renew in Organizer.
Posting this again here..
OK, I had the same problem with the disabled 'Renew' button against my Team Provisioning Profile.
This worked for me.
1) Deleted the expired Team Provisioning Profile from the Xcode Organizer.
2) Deleted the same thing from the developer provisioning portal.
3) Again from Xcode organizer check marked the auto provision and clicked 'Refresh'. it asked for the credentials and in a few seconds added the renewed Team Provisioning Profile.
4) It also added the new profile in the developer provisioning portal.
Refresh and removing the iOS devices did not help on my installation.
But I found that the error messages was misleading. I am also member of the Mac developer program and after choosing "My Mac" under DEVICES and pressing the (+) Add to Portal button, the error message "Your team has no devices for which to generate a provisioning profile." did no longer appear.
So it looks like the error message covers the Mac and not iOS devices even that the URL at the end of the error message links to the iOS development center.
I had the issue that Xcode didn't refresh or renew it's managed Team Provisioning Profile and tried a very long time. I always hit refresh in the Library->Provisioning Profiles - section. Then I tried out the Teams section and after hitting the refrsh button there my Team Provisioning Profile which was managed by Xcode was renewed successfully. Hope this helps some of you.
One more thing: I used the same Apple-ID in three teams. So maybe Xcode failed to separate them while refreshing.
Do these things if you want to really solve the problem:
(1) Are you using the certificate for which you made provisional profile from your mac? Or you are using the certificate from other mac machine. If that is the thing then please get .p12 file from there and install in your keychain.
(2) If your certificate in the keychain is the same for which you made the provisional profile then it's fine. Otherwise you have to create new provisional profile for the certificate.
(3) Please make sure that you have set the app id in the target > properties > identifier. If no then please set and choose the provisional profile from the target > build > code signing identity.
(4) Then clean and build your project.
If you find any problem then please let me know. I would like to solve this problem.
I fixed it by signing into my Apple ID in XCode->Preferences->Accounts tab
Is the certificate it is based on expired? Did you delete the device it was for?
Try deleting the profile and click Refresh so Xcode re-adds it. Just a guess. I don't know why this would work, but it's worth a try.
Are you pressing the renew button from within Organizer in the latest Xcode version, 3.2.5 beta 3?
Here's the answer to compiling question, however, if anyone else has the answer to the team provisioning profile please post.
You can still compile apps for your device/simulator by creating a developer profile and downloading it to your device.
The key to getting it to work is to make sure the profile is selected in both the Edit Project and Edit Target Settings from the Project Menu. The Target Setting is more specific and usually screws people up. Making sure they are both in sync will help you get things up and running.
From these two menus, check the Build tab and make sure the developer profile is displayed. The default is iPhone Developer and should point to your downloaded profile.
Is there a problem using a different mobileprovision file? I believe you are getting the error on using a different provision file because your Target might be using the older one.
Try this
Get the new mobileprovision file and
in Project's Build properties, set
the mobileprovision to this one
Select the active target and in the
target's Build properties, ensure
that the same mobileprovision is
being used
Compile the app.
See if that helps.
As far as the Team Provisioning profile goes:
Does your console say anything? Are you using Xcode 3.2.5? I'd file a radar at http://bugreport.apple.com. Do you see the Team Provisioning file in the iOS Provisioning Portal? Does it have a green light?
You might try revoking it and letting Xcode create a new one.
As far as getting your app to work
You can always create an app-specific development profile. Choose your certificate and the app you are working on. Also make sure to select your device in the checkbox list.
Then download the profile (once it is ready) and double click on it to import it into Xcode.
If you look at the Xcode organizer, you should see your development profile in the list.
If it's red, that means your certificate has expired
If it's yellow, that means you don't have the private key present to sign using the selected certificate
In the project's Get Info window, under code signing, choose iPhone Developer for both pickers. Take a look at see which one is automatically selected (sometimes you have to manually choose the right one).
Then do a Clean & Build and you should be good to go.
I made the mistake of looking in Wrong place in Organizer.
On the left is LIBRARY then below that DEVICES
I had clicked on my Iphone under DEVICES > Prov profile.
No refresh button there.
Correct place is
On the left in ORGANIZER is Library > Provisioning Profiles
then Team provision Profile is here
Click on it and hit refresh if expired
As always.... "grep -ir profile ." and the cmd line are always your best friend when you want to fix an Apple frustrating, inconvenience and pain in the ass.... Spent almost an hour poking around xcode trying to find that option to enter the new provisioning profile number, and none to be found... Only when I grep'd for it, was I able to fix, yet another apple pain in the ass.... I can't tell you how many times I've spend hours going through xcode, stuck, because it won't compile because of some stupid invalid setting, profile or argument, only to fix it when I fell back on grep & ssed...
This worked for me:
start xcode.
Window->Organizer from menu
Choose "Provisioning Profiles" from DEVELOPMENT menu.
click refresh button
exit organizer
return to xcode main window.
Build->Clean from menu
build and run.
I fixed this by going to the portal and clicking "modify" on all expired profiles. Then click "select all" for devices and submit.

What's the correct procedure for replacing an expired developer's certificate on an iPhone xCode project?

My iPhone developer certificate expired. I got a new one (developer_idendity.cer) but I'm not sure how to make my xcode project and my iPhone use it.
I keep getting the Code Sign error: a valid provisioning profile matching the applications Identifier 'com.example.foo' could not be found.
What's the procedure to follow when your developer certificate expires?
I created a new "developer_identity.cer" and put it on my keychain. Then I got a new "mycompany.mobileprovision". When I try to add this to xcode via the Organizer, I see the message:
A Valid signing identity matching this profile could not be found in your keychain.
Any idea of what "signing identity" Xcode is looking for when I try to put in my update provisioning profile?
Make sure you have your new provisioning profile selected within the Project Info Panel. Click on your xcode project file on left under Groups & Files then click the Info Button beside the search box. When the info panel pops up, select the build tab then scroll down to the code signing field and select your new code signing identity there. It should work now. You might have to do it for your target file also. Basically repeat these same steps but click on the Target file under Targets in the Groups & Files pane. I hope this helps. There really is no wrong way to replace your expired certificates. Just add them to your key-chain and make sure you delete the old expired ones or there might be a conflict.

Cannot run code on device

I have some source code which I had developed and later gave to another team. They signed it with their certificate and provisioning profile.
Now I have the code back and have set the appropriate values in the project properties for code signing identity (with my cert and profile). But when I run the application on a device, I get an error showing the other team's certificate and prompting that the provisioning profile does not exist.
I don't know where it is being referenced.
Can someone please help.
Thanks.
Check the Target properties, not just the Project, because it could be overridden there.
Similar thing just happened to me, in my case the "Target" settings were still set to the previous developer's certificate, while my "Project" settings were set to my new certificate. Xcode reported:
"Code Sign error: The identity 'iPhone Developer: ' doesn't match any valid certificate/private key pair in the login keychain"
Boot's answer worked for me - there are "Target" settings for signing that override the "Project" settings, which is why you may have needed to recreate the whole project, if you only changed the "Project" settings.
Change the Active SDK from iphone device to Iphone simulator. This will let you test your code on your iphone simulator. You need a cert if you plan on running your app on your device. (Maybe the code that you got was signed for device).
Under Project > Edit Project Settings... click on the Configurations menu and select All Configurations. Then scroll down to Code Signing (or type it into the search field) to verify your provisioning information, changing the Code Signing Identity as needed.
connect your iphone, open organizer, there you first need to delete the profile of your other team, and then force an add of your profile (by drag and drop or clicking the + button)
once done, change your code signing settings from the project info window and you should be okay. i faced the same problem and had to do the above to resolve it
Solution people
http://developer.apple.com/iphone/library/qa/qa2008/qa1618.html