简体   繁体   English

由于证书问题,无法在设备上运行Xcode项目

[英]Can't run Xcode project on device due to certificate issues

This is the first question I've ever posted. 这是我发布的第一个问题。

I am trying to run an Xcode 9.0.1 project on an iPhone 6 Plus and these three errors come up: 我试图在iPhone 6 Plus上运行Xcode 9.0.1项目,出现以下三个错误:

  • Code Signing Error: The user name or passphrase you entered is not correct. 代码签名错误:您输入的用户名或密码不正确。

  • Code Signing Error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "KP3X78QM3M" with a private key was found. 代码签名错误:未找到签名证书“​​ iOS开发”:未找到与团队ID“ KP3X78QM3M”匹配且具有私钥的“ iOS开发”签名证书。

  • Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0' 代码签名错误:SDK'iOS 11.0'中的产品类型'Application'需要代码签名

I suspect this is caused by Xcode not being able to read the developer certificates on my computer. 我怀疑这是由于Xcode无法读取计算机上的开发人员证书引起的。 This is what the General tab looks like under Signing . 这是“签名”下的“常规”选项卡 Clicking "Try Again" will generate a new certificate but all of the errors still remain. 单击“重试”将生成一个新证书,但所有错误仍然存​​在。

I checked the Keychain Access application and it has an iPhone developer certificate , although I'm not sure if anything else is missing. 我检查了钥匙串访问应用程序, 它具有iPhone开发人员证书 ,尽管我不确定是否还有其他内容。

I've looked up similar questions and started reading Apple's Xcode troubleshooting guide but I am still confused and don't want to accidentally modify anything important. 我查找了类似的问题,并开始阅读Apple的Xcode故障排除指南,但我仍然感到困惑,不想意外修改任何重要内容。

I desperately need to fix this issue; 我非常需要解决此问题; if there is an Apple support email or someone I can contact in person about this, that would be amazing. 如果有Apple支持电子邮件或我可以就此与我联系的人,那就太好了。

Thanks in advance! 提前致谢!

I found a solution! 我找到了解决方案!

Even though this question only has a few views, I'll share it in case anyone else has the same problem in the future. 即使这个问题只有少数观点,我也会分享,以防将来其他人遇到同样的问题。

Long story short, I Quit Xcode while the two errors were still present in the Signing section of the General tab. 长话短说,我退出Xcode,而“常规”选项卡的“签名”部分中仍然存在两个错误。 At this point, clicking Preferences -> Accounts -> Manage Certificates still gave the "Missing Private Key" error messages like so. 此时,单击首选项->帐户->管理证书仍然显示“缺少私钥”错误消息

After quitting Xcode I restarted the computer and opened Xcode again. 退出Xcode后,我重新启动计算机并再次打开Xcode。 Under the Signing section for the General tab, it prompted me to log in with my Apple ID. 在“常规”选项卡的“签名”部分下,它提示我使用我的Apple ID登录。 After logging in, the two errors were gone. 登录后,这两个错误消失了。 I opened the "Keychain Access" application on the mac, clicked on the "My Certificates" tab and noticed that a new certificate had been generated WITH a drop down arrow that contained a new private key! 我在Mac上打开了“钥匙串访问”应用程序,单击了“我的证书”选项卡,并注意到已经生成了一个新证书,带有一个包含新私钥的下拉箭头!

To set up the new key so it works, connect your device (in my case an iPhone 6 plus) to your mac and run your Xcode project on the device. 要设置新密钥以使其起作用,请将您的设备(在我的情况下为iPhone 6 plus)连接到Mac,然后在该设备上运行Xcode项目。 A window titled 'codesign wants access key "access" in your keychain." should pop up, wanting the password for your computer. 将会弹出一个标题为“ codesign想要访问钥匙串中的访问钥匙”的窗口。”,需要您的计算机密码。

VERY IMPORTANT: Type your computer login password (not your Apple ID password) and click ALWAYS ALLOW! 非常重要:键入您的计算机登录密码(而不是Apple ID密码),然后单击“允许”! I got confused and accidentally hit "Deny" the first time around which is what got me into this mess in the first place. 我很困惑,第一次不小心打了“ Deny”,这就是让我首先陷入困境的原因。 Click "ALWAYS ALLOW"!!! 点击“总是允许” !!!

After this point, Xcode should be able to run your app on a device. 此后,Xcode应该能够在设备上运行您的应用程序。

Good luck! 祝好运!

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

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