17

In iPhone Developer Program Portal, there's a video to demonstrate how to create a development certificate and assign a private key

Now I have finished the development process and starting to distribute

I have created a "Distribution Certificate", but how do I assign a private key to this certificate?

As it got the "CodeSign error: code signing identity '...' does not match any code-signing certificate in your keychain" when compiles

It will be glad to let me now if I need to assign a private key to the distribution cert and how.

Please be noticed that I am NOT talking about development certificate here, thanks.

4 Answers 4

37

As no one has updated or answered this question since Nathan pointed out the original answer link is unavailable (Point number one on posting on stackoverflow "Please be sure to answer the question") here is an answer from my experiance, hope it helps someone:

For this specific question (Dev/Distribution cert installed but no private key) the answer is a choice of 2 alternatives:

1. Create a new certificate identity via the apple devloper portal In this case you'll need to log into the apple developer portal and use the assistant, as part of this you will need to create and upload a CSR (Certificate Signing Request) which will also create the public and private keys on the machine. Apple sign the request and voila, a signed public/private certificate pair : Reference

2. Export the private key from the machine originally used to create the Certificate This case is when your signing with an identity previously created, probably on an old machine or if (as in my case) your developing for a client that has their ID's already created. If you can't access the machine originally used to create the certificate identity you'll have to create a new identity as per the guide/assistant.

To do this, you will need to export your private key (a .p12 file), or public/private key pair via Keychain Access, and install the private key or key pair to the machine your developing on. Here's a guide I found on stackoverflow.

Ref: http://iphonedevsdk.com/forum/iphone-sdk-development/11498-problems-exporting-importing-p12-private-key-for-developing-on-another-mac.html

PS> Be warned, I am performing the latter option right now, and while evidence suggests this will work, it is untested by me as of yet, If if doesn't work I will re-reply!

3
  • your step 1 reference is no more. this page has it: support.brightcove.com/en/app-cloud/docs/…
    – DanMoore
    Commented Mar 27, 2014 at 21:38
  • These links are dead. Commented Apr 11, 2022 at 20:30
  • It's pretty easy. Go to file>export on the origin Mac. Then airdrop to the other mac you want it on. Then double click it on that Mac. Commented Nov 16, 2023 at 13:52
7

Read the Maintain Signing Assets section of the Xcode Help site. It explains step-by-step what you will need to do, in the correct order.

Before you can code sign your app, you create your development certificate and later, a distribution certificate to upload your app to iTunes Connect. You can create all the types of certificates and signing identities you need using Xcode. Xcode creates, downloads, and installs your signing identities for you.

All team members can create their own development certificate. Only a team agent or admin can create a distribution certificate. Only a team agent can create a Developer ID certificate. If you have an organization membership, read Managing Your Team in Member Center for a description of team roles and tasks that team agents perform on behalf of team members.

Xcode creates your development certificate for you when you need it. For example, when you assign your project to a team or create the team provisioning profile, as described in Configuring Identity and Team Settings, Xcode creates your development certificate and adds it to the team provisioning profile. Because of this, you typically create distribution certificates using the Xcode Preferences window.

To create a signing identity

  1. In the Xcode Preferences window, click Accounts.

  2. Select the team you want to use, and click View Details.

  3. In the dialog that appears, click the Create button in the row of the type of certificate you want to create.

    If the Create button is disabled, you are not allowed to create that type of signing identity. For a description of each type of certificate, refer to Table 14-2.

    After the signing identity is created, the Create button disappears.

  4. To return to Accounts preferences, click Done.

6
  • Haha the answer is so obvious, I am sorry about overlooking it.
    – Unreality
    Commented Mar 27, 2009 at 9:32
  • 5
    This is not longer true btw. This page has changed so that it has only about 1 paragraph of information.
    – Nathan
    Commented Jul 20, 2012 at 15:03
  • 1
    Good lord and biscuits. Okay. For the benefit of readers, this answer was written more than three years ago. Commented Jul 20, 2012 at 18:51
  • 23
    Link is now 404. This is why you should answer the question instead of linking. Commented Aug 12, 2013 at 18:25
  • 3
    Downvoted. Linking to a dead page is obviously of no benefit for anyone. Please either delete the answer or update it to be a proper answer. Commented Jan 18, 2014 at 16:24
0

For me - restarting Xcode solved both these issues.
Everything was obviously setup correctly somewhere, but needed to be flushed/synced.

2
  • I also find that restarting Xcode is often necessary. Obviously this isn't the full answer to the question, but it may be part of the answer for some. Commented Sep 26, 2013 at 23:45
  • 1
    This was the solution to my problem. I don't think this answer deserves the downvotes that it has...
    – Keith
    Commented Jul 17, 2014 at 12:15
0

If you hover over the image and click the small red delete icon, then save this. Navigate away and come back to this page you will be able to add the icon again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.