ios Xcode:iPhone 应用程序协同设计错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/400894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 15:28:16  来源:igfitidea点击:

Xcode: iPhone app codesign error

iphoneiosxcodecode-signingxcrun

提问by Gabe Hollombe

When building a new iPhone app in Xcode, I'm getting this error:

在 Xcode 中构建新的 iPhone 应用程序时,我收到此错误:

codesign error: code signing identity 'iphone developer' does not match any code-signing certificate in your keychain. once added to the keychain, touch a file or clean the project to continue.

代码签名错误:代码签名身份“iphone 开发人员”与您钥匙串中的任何代码签名证书都不匹配。添加到钥匙串后,触摸文件或清理项目以继续。

What's the fix?

有什么解决办法?

回答by Gabe Hollombe

The fix is pretty simple. In the Build Results window (which you probably got to by clicking the error icon in the lower right corner of your project window), change the pulldown menu from ‘Device - iPhone xxx' to ‘Simulator - iPhone xxx'.

修复非常简单。在“构建结果”窗口(您可能通过单击项目窗口右下角的错误图标获得该窗口)中,将下拉菜单从“设备 - iPhone xxx”更改为“模拟器 - iPhone xxx”。

xcode-screenshot
(source: kickasslabs.com)

xcode 截图
(来源:kickasslabs.com

回答by Shalmanese

You need to be part of the $99 developer program to test on the actual phone. Apple should have info about how to sign your code once you're accepted into the program.

您需要加入 99 美元的开发人员计划才能在实际手机上进行测试。一旦你被程序接受,Apple 应该有关于如何签署你的代码的信息。

回答by lajos

I got this error when I accidentally modified the code signing identity build setting at the target rather than the project level. Make sure that you have the correct information entered at the project level (get info on the project, rather than the target.) If you changed the target build settings, try deleting the values from there. The target will then inherit the project's setting.

当我不小心修改了目标而不是项目级别的代码签名身份构建设置时,我收到了这个错误。确保您在项目级别输入了正确的信息(获取有关项目的信息,而不是目标。)如果您更改了目标构建设置,请尝试从那里删除值。然后目标将继承项目的设置。

I would also do a "clean all", then exit xcode, delete everything from the build folder and try to do another build. (This is an Xcode voodoo trick that seems to solve many code signing issues.)

我也会做一个“全部清理”,然后退出 xcode,从构建文件夹中删除所有内容并尝试进行另一个构建。(这是一个 Xcode 伏都教技巧,似乎解决了许多代码签名问题。)

回答by Gary Davies

I just solved my code signing problem. What a nightmare! Over 8 hours of frustration over two days. I tried new apps, new app names, new certificates, deleting provisioning profiles etc. Basically I had two "iPhone Distribution" certificates in my keychain causing all code signing to fail. But one was hidden! The visible cert was in my Login keychain. The invisible cert was in my System keychain. Be warned, add your certificate to either keychain but not both! I deleted the certificate from the System keychain and it became a ghost certificate. It no longer appears in the System keychain "Keychain Access" tool but it did exist in the actual System keychain file, so effectively it had not been removed. I grepped the keychain file for the word Distribution and there it was! My solution was to remove that line containing iPhone Distribution from the keychain file which fixed the code signing. The result is I have a broken System keychain. But I can sign apps again \m/

我刚刚解决了我的代码签名问题。什么样的恶梦!两天内经历了超过 8 小时的挫败感。我尝试了新应用程序、新应用程序名称、新证书、删除配置文件等。基本上我的钥匙串中有两个“iPhone 分发”证书导致所有代码签名失败。但是一个被隐藏了!可见证书在我的登录钥匙串中。隐形证书在我的系统钥匙串中。请注意,将您的证书添加到任一钥匙串,但不要同时添加!我从系统钥匙串中删除了证书,它变成了一个幽灵证书。它不再出现在系统钥匙串“钥匙串访问”工具中,但它确实存在于实际的系统钥匙串文件中,因此实际上它没有被删除。我搜索了单词 Distribution 的钥匙串文件,它就在那里!我的解决方案是从修复代码签名的钥匙串文件中删除包含 iPhone Distribution 的那一行。结果是我的系统钥匙串坏了。但我可以再次签署应用程序 \m/

回答by Sam Dobbins

this may sound funny, but I searched everywhere for a solution. Eventually I found out that in Xcode in the top left, the dropdown where you select Device and verison, I had "debug" selected in the dropdown instead of release. Once I selected release the problem was fixed.

这听起来可能很有趣,但我到处寻找解决方案。最终我发现在左上角的 Xcode 中,您选择设备和版本的下拉列表中,我在下拉列表中选择了“调试”而不是发布。一旦我选择了发布,问题就解决了。

回答by heemin

This situation is happening when you receive a Xcode project from other person.

当您从其他人那里收到 Xcode 项目时,就会发生这种情况。

Here is what I did to solve the problem.

这是我为解决问题所做的工作。

  1. Register your key in a key chain access. You can download your key in iOS provisioning portal. (Application -> Utility -> Keychain Access)
  2. Install Provisioning file for the app.
  3. Change iPhone developer in a project configuration. (Target Info -> Build tap -> Code Signing -> Code Signing Identity and Any iOS)
  1. 在钥匙串访问中注册您的钥匙。您可以在 iOS 配置门户中下载您的密钥。(应用程序 -> 实用程序 -> 钥匙串访问)
  2. 安装应用程序的配置文件。
  3. 在项目配置中更改 iPhone 开发人员。(目标信息 -> 构建点击 -> 代码签名 -> 代码签名身份和任何 iOS)

回答by Matt N.

I had the same problem. Found the fix here:

我有同样的问题。在这里找到了修复:

iphone sdk tools utilities

iphone sdk 工具 实用程序

In Keychain Access.app my Developer Certificate would show up as "This certificate was signed by an unknown authority". The reason was that I didn't have the ADC intermediate certificate (which you can download from "Provisioning Program" in "Certificates" tab. Once I installed this the developer certificate showed up correctly in keychain and my code could be deployed on the bloody phone.

在 Keychain Access.app 中,我的开发人员证书将显示为“此证书由未知机构签名”。原因是我没有 ADC 中间证书(您可以从“证书”选项卡中的“配置程序”下载。一旦我安装了这个,开发人员证书就会正确显示在钥匙串中,我的代码可以部署在血腥的电话。

回答by dchakarov

When none of the above helped me, I accidentally removed my card reader with my electronic signature certificate on it and now my app builds without errors. If you have such certificate, try unplugging it for a moment.

当以上都没有帮助我时,我不小心移除了带有电子签名证书的读卡器,现在我的应用程序构建没有错误。如果您有这样的证书,请尝试将其拔下片刻。

回答by LAOMUSIC ARTS

I just solved my problem doing this:

我刚刚解决了我的问题:

  • click in your main project folder in Project Navigator
  • at the right side window, choose your Target
  • under "Code Signing", change the Code Signing Identity from whatever it was to yours
  • set the active scheme (at top left, besides the "Run" button) to your iPhone/iPad
  • 单击项目导航器中的主项目文件夹
  • 在右侧窗口中,选择您的目标
  • 在“代码签名”下,将代码签名标识从任何内容更改为您的
  • 将活动方案(在左上角,除了“运行”按钮之外)设置为您的 iPhone/iPad

Hope this help someone out there !

希望这可以帮助那里的人!

回答by LAOMUSIC ARTS

No Voodoo necessary. Sometimes some app changes default keychain and Xcode stops finding iPhone Developer Keys. The solution is simple (it worked for me):

不需要巫毒。有时,某些应用程序会更改默认钥匙串,而 Xcode 会停止查找 iPhone 开发人员密钥。解决方案很简单(它对我有用):

  1. List item Start Keychain Access app
  2. Ctrl+click on keychain where you stored your development keys and select Make Keychain Default
  3. Enjoy developing great iPhone apps.
  1. 列表项 启动钥匙串访问应用程序
  2. Ctrl+单击存储开发密钥的钥匙串,然后选择将钥匙串设为默认值
  3. 享受开发出色的 iPhone 应用程序的乐趣。