77

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

Bhavin
  • 27,155
  • 11
  • 55
  • 94
Pinky
  • 1,217
  • 4
  • 17
  • 27
  • 4
    Just repeating the title as the question probably isn't going to make people want to help you ;) Have you ever been able to sign an app before or is this the first time you have seen this error? – deanWombourne Jan 21 '10 at 11:44
  • None of this works... Any idea ? – Rabskatran Mar 31 '11 at 10:41
  • it works read the comment below meaning answer – Pinky May 25 '11 at 07:08
  • Pulling out my hair on this as none of these work. Running xCode 4.1 and upgraded to 4.2 with no change in the error – Phill Pafford Oct 18 '11 at 02:21
  • @deanWombourne : have the same error message and nothing more. Any way to get more verbosity from code signing tool? And what is this tool anyway? – Artem Oboturov Oct 21 '11 at 10:55
  • There's not much more the error could say :) It means that your profile doesn't match a certificate in your keychain _or_ your certificate in the keychain wasn't signed by your public/private key pair. – deanWombourne Oct 21 '11 at 11:17
  • Accepted answer is not the ONLY reason this happens. Real answer for me: Code Signing Identity. (See ALL the answers on this one) – Warren P Jan 24 '13 at 18:41

12 Answers12

63

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.

sudo rm -rf
  • 29,408
  • 19
  • 102
  • 161
  • It works well but, to upload app to appstore we have select "Build for Archive" that time I getting the above error please help me – Vineesh TP May 02 '12 at 11:22
  • Try rebuilding all your keychain certificates. It sounds like you're missing the all important key. – sudo rm -rf May 02 '12 at 15:25
  • So many variations from "rebuild keychain" search results! Could you please add a way to rebuild your keychain certificates and setting your build settings to Simulator, @sudorm-rf? – Danny Feb 12 '13 at 18:33
  • 1
    @Danny: Ah, it's been quite a while since I've had to deal with all of those code-signing issues. I think you'd have better luck asking that in a new question. – sudo rm -rf Feb 12 '13 at 19:58
53

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---

  1. Goto Targets... Build Settings tab
  2. 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.

enter image description here

Warren P
  • 65,725
  • 40
  • 181
  • 316
Rich M.
  • 561
  • 4
  • 4
  • 3
    Where's this "Targets" thing? I have the same problem, but can't find the targets to change... – Brian Knoblauch Sep 17 '12 at 17:05
  • CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 6.0' – Steve Tauber Oct 16 '12 at 00:34
  • If you change this and get the error above about code signing required then here is the solution: http://stackoverflow.com/questions/9899920/code-signing-is-required-for-product-type-application-in-sdk-ios5-1 – Steve Tauber Oct 16 '12 at 00:40
  • Thanks for the answer. I contributed a picture in hope it helps someone else not scream and yell as much as I was when this was blocking me. Go to the build settings and type "Code Signing" into the search box, and it becomes much easier to find this part of the settings. – Warren P Jan 24 '13 at 18:47
  • Worked in XCode 4.6.2 also. Thanks! – haa Apr 16 '13 at 20:37
  • For those that can't find this dialog... Click once on the main project in the Project Navigator to the left (where the project file structure is shown). This then brings up the project settings to the right. – Mattygabe Feb 22 '15 at 17:00
13

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'

LordFire
  • 131
  • 1
  • 3
  • That did the trick for me (Xcode 4.6). In my case I think this was happening because we are multiple developers involved in `git` and included the whole workspace into the repository (I since gitignored `project.xcworkspace/xcuserdata/`) – Pierre de LESPINAY Feb 05 '13 at 08:20
  • +1, and for Xcode 4.6.1: Products > Destinations > x Simulator – danwild Apr 30 '13 at 01:09
12

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.

C0D3
  • 6,440
  • 8
  • 43
  • 67
7

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.

Bhavin
  • 27,155
  • 11
  • 55
  • 94
6

This usually happens to me when I forget to change the company to match mine.

  1. Select the target under Groups & Files
  2. Click the Get Info button
  3. Choose the Properties tab
  4. 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

David Kanarek
  • 12,611
  • 5
  • 45
  • 62
6

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

ideaddict
  • 61
  • 2
  • 2
5

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:

  1. 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

  2. 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.

  3. Now connect iOS device and rebuild targeting the iOS device.

Aidan Donohoe
  • 191
  • 2
  • 3
4

In my case, I didnt have the Apple Root certificate. It can be found here:

http://www.apple.com/certificateauthority/

Maarten
  • 41
  • 1
2

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.

  1. If your certificate has expired, renew it at the iPhone Portal, download it, and double-click it to add it to your Keychain.
  2. 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.
  3. 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.
  4. 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".
  5. 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.
  6. if you still getting problem then contact support apple community.
akjoshi
  • 15,374
  • 13
  • 103
  • 121
  • Found confirm that the Online Certificate Status Protocol (OCSP) and the Certificate Revocation List (CRL) are set not set to "Off" in Keychain Access > Preferences > Certificates. – T.J. Jul 18 '13 at 18:38
1

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

Amdine
  • 11
  • 2
1

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'

nsof
  • 2,299
  • 1
  • 20
  • 28