简体   繁体   English

Xcode 4.2-代码签名错误

[英]Xcode 4.2 - Code Signing Error

I finally succeeded in building my first iPhone app but now I am pulling some hair out over a code signing problem. 我终于成功构建了我的第一个iPhone应用程序,但是现在我在解决代码签名问题方面付出了很多努力。

This is the error message I get when I try to build the code in Xcode for my device - 这是我尝试在Xcode中为设备构建代码时收到的错误消息-

Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain 代码签名错误:“ iPhone开发者”身份与默认钥匙串中的任何有效证书/私钥对都不匹配

In the organizer, I have a warning - Xcode could not find a valid private-key/certificate pair for this profile on your keychain. 在组织者中,我有一个警告-Xcode在您的钥匙串上找不到用于此配置文件的有效私钥/证书对。

I have tried the following things - 我尝试了以下方法-

  1. I have deleted and re-created all the certificates from my Provisioning profile on developer.apple.com 我已经从developer.apple.com上的“供应”配置文件中删除并重新创建了所有证书。

  2. In Utilities->Keychain, I have deleted the certificates from the System Keychain. 在实用程序->钥匙串中,我已从系统钥匙串中删除了证书。 The certificate is stored only in the login keychain. 证书仅存储在登录钥匙串中。

  3. I have re-started my Xcode and also my Mac 我已经重新启动了Xcode和Mac

  4. In the target, code signing section I have tried both iPhone Developer and also iPhone Distribution. 在目标的代码签名部分中,我尝试了iPhone Developer和iPhone Distribution。 For some reason the provisioning profile that I created has been grayed out. 由于某种原因,我创建的配置文件已灰显。

So now I have no idea what's going on and don't know what to do. 所以现在我不知道发生了什么,也不知道该怎么办。 I'll appreciate any help. 我将不胜感激。

Thanks a lot. 非常感谢。

In addition to the provisioning profiles, you also need the private keys for your developer account (one for development and one for distribution). 除了供应配置文件外,您还需要开发人员帐户的私钥(一个用于开发,一个用于分发)。

The provisioning profiles list all of the devices which the app is able to run on. 供应配置文件列出了该应用能够在其上运行的所有设备。 But the actual app is signed with your account's private key. 但是实际的应用程序是使用您帐户的私钥签名的。 This key is not stored in Xcode, it's stored in Keychain Access (to ensure it's encrypted with your user login credentials). 此密钥未存储在Xcode中,而是存储在“钥匙串访问”中(以确保使用您的用户登录凭据对其进行加密)。

  1. Go to the iOS developer center (https://developer.apple.com/devcenter/ios/index.action) and log in. 转到iOS开发人员中心(https://developer.apple.com/devcenter/ios/index.action)并登录。
  2. Click on the iOS Provisioning Portal link on the right 单击右侧的iOS Provisioning Portal链接
  3. Click Certificates on the left 点击左侧的证书
  4. If you don't already have one, you need to add a certificate under the development tab. 如果还没有,则需要在“开发”选项卡下添加证书。
  5. Click the certificate's "download" link, to download it, and then open the file in Keychain Access. 单击证书的“下载”链接,将其下载,然后在“钥匙串访问”中打开文件。
  6. You can (and should) now delete the downloaded certificate file. 您现在可以(并且应该)删除下载的证书文件。 You don't really want that file flying around anywhere, because it is used to sign your code. 您实际上并不希望该文件随处可见,因为它用于签名代码。 If you have a backup system like Time Machine running, I would turn it off during this process to ensure it doesn't backup the unencrypted certificate (once it's in the keychain, it is safely encrypted). 如果您有像Time Machine这样的备份系统在运行,我会在此过程中将其关闭,以确保它不会备份未加密的证书(一旦它位于钥匙串中,便会被安全地加密)。

At some point you will need to repeat those steps, but for the "Distribution" tab of the certificates section. 在某些时候,您将需要重复这些步骤,但是对于“证书”部分的“分发”选项卡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM