Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

ios - Xcode could not find a valid private-key certificate pair for this profile in your keychain

[Before immediately marking as a duplicate, I've read through a few others with the same problem description but don't have a solution after applying answers from them]

Several days ago I created a profile and was successfully able to use it to run app on my iPhone.

Now however I am using a different laptop for development and am unable to progress as I keep getting a "Xcode could not find a valid private-key certificate pair for this profile in your keychain". I have tried with the same iPhone/profile combination as I used previously, in additional I have another iPhone and have generated a new profile with that device's id. However I get the same message with that profile/phone too.

From other postings on this site seems people got this problem when the profile had not been dragged/dropped in the Library section of Organizer - I dragged the profiles on Xcode and there is a resulting Provisioning Profiles section containing the relevant profile in both the Library section and Devices section of Organizer.

The certificate is showing as being valid in Keychain Access.

Any suggestions?

Added Later: trying this Q&A from Apple:

https://web.archive.org/web/20141029102125/http://developer.apple.com/library/ios/qa/qa1618/_index.html

They say within Keychain Access click on the .p12 file. What are they talking about, what and where is the .p12 file? Its not shown in their own documentation screen shots and nor does it appear in my Keychain Access. Is it supposed to?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The best thing you can do is delete the certificates from your Keychain and get them back so XCode 4's Organizer stops being "confused". I've compiled it in 7 "easy" steps:

  1. Delete your Certificates: Open the Application called Keychain Access on your Mac (You can hit the keys command + space bar on your keyboard to bring Spotlight and type Keychain Access to launch it). Then select login on the upper left list and Certificates on the lower left list, you will delete only the Certificates starting with the words "iPhone Developer" or "iPhone Distribution".

  2. You need to revoke the old certificates by logging into your Apple iOS Developer's account and going to the Provisioning Portal and then to the Certificates option on the left menu. Then locate your Developer Certificate and click on the link located at the right that reads "Revoke".

  3. Go back to the Keychain Access Application on you Mac, click on the menu bar the following menus: "Keychain Access" -> "Certificate Assistant" -> "Request a Certificate from a Certificate Authority". Just enter you email if needed and modify the option that says "Request is:" selecting the option "save to disk"... a dialog will ask you where do you want to save a CSR file which is normally called "CertificateSigningRequest.certSigningRequest".

  4. Go back to the online Provision Portal and create a new Certificate uploading the file you just generated on the same option where your old Certificates were before.

  5. After a minute or so... you will see under the Certificates list that you can now Download you new certificate and that you can also download a WWDR intermediate certificate (See the links under the certificate list). Download them and give them to your Keychain Access by double-clicking them.

  6. You will have to go to the Provisioning Portal menu option called Provisioning where you will see all your App's Development Provisioning Profiles. You will have to click the link "Edit"->"Modify" at the right and verify that the Certificate is checked.

  7. Finally, just close "XCode 4". When you re-open it, go to the menu "Window" -> "Organizer". Because the Organizer reads the certificates from you keychain, they should be there already. Next time you plug your devices just click on Provisioning and make sure the old certificates are gone and the new certificate is on.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...