简体   繁体   English

Xcode'CodeSign错误:需要代码签名'

[英]Xcode 'CodeSign error: code signing is required'

I've been working on an iPhone project with iOS 4.0. 我一直在研究iOS 4.0的iPhone项目。 I just downloaded Xcode 3.2.4 with iOS SDK 4.1 so that I can work with the updated iOS. 我刚刚使用iOS SDK 4.1下载了Xcode 3.2.4,以便我可以使用更新的iOS。 Upon opening the project in the udpated Xcode, I found that the target read 'Base SDK Missing'. 在udpated Xcode中打开项目后,我发现目标读为“Base SDK Missing”。 I fixed that by following the instructions here . 我按照这里的说明修复了它。

Now when I try building targeting any version of iOS, I receive this error (with the corresponding version referenced in the error text): 现在,当我尝试构建针对任何版本的iOS时,我收到此错误(错误文本中引用了相应的版本):

CodeSign Error: code signing is required for product type 'Application' in SDK 'Device - iOS 4.1' CodeSign错误:SDK“设备 - iOS 4.1”中的产品类型“应用程序”需要代码签名

I have the Team Provisioning Profile created by Xcode installed, that Provisioning Profile has my certificate, and the Code Signing Entity selected is 'iPhone Developer: Aaron Milam'. 我安装了由Xcode创建的Team Provisioning Profile,Provisioning Profile有我的证书,选择的Code Signing Entity是'iPhone Developer:Aaron Milam'。

Any ideas as to what I could be missing here? 关于我在这里可能缺少的任何想法?

It happens when Xcode doesn't recognize your certificate. 它发生在Xcode无法识别您的证书时。

It's just a pain in the ass to solve it, there are a lot of possibilities to help you. 解决它只是一个痛苦,有很多可能来帮助你。

But the first thing you should try is removing in the "Window" tab => Organizer, the provisioning that is in your device. 但是你要尝试的第一件事就是在“窗口”选项卡中删除=>管理器,即设备中的配置。 Then re-add them (download them again on the apple website). 然后重新添加它们(在苹果网站上再次下载)。 And try to compile again. 并尝试再次编译。

By the way, did you check in the Project Info Window the "code signing identity" ? 顺便问一下,您是否在项目信息窗口中检查了“代码签名身份”?

Good Luck. 祝好运。

Be sure you code sign on the line " any iOS SDK " and not "Debug/Distribution/Release" 确保您在“ 任何iOS SDK ”行上编码,而不是“调试/分发/发布”

Here is exactly what I did : 这正是我所做的:

Code signing identity -> don't code sign 代码签名身份 - > 不代码签名
* Debug -> don't code sign *调试 - > 不要编码签名
** any iOS SDK -> [my developer profile] **任何iOS SDK - > [我的开发人员资料]
* Distribution -> don't code sign *分发 - > 不要编码签名
** any iOS SDK -> [my AppStore profile] **任何iOS SDK - > [我的AppStore个人资料]
* Release -> don't code sign *发布 - > 不要编码签名
** any iOS SDK -> [my AdHoc profile] **任何iOS SDK - > [我的AdHoc个人资料]

When I put my profiles one level above (at Debug/Ditribution/Release), it doesn't work for some reason (bug ?). 当我把我的配置文件放在上面一级时(在Debug / Ditribution / Release),它由于某种原因不起作用(bug?)。

Hope it helps some of us ! 希望它能帮助我们中的一些人!

  • I love Stack Overflow: 我喜欢Stack Overflow:

  • I realized that some time being too specific is not enough that is because we may have different Xcode version, I have 2 xcode version on the same Mac Pro myself. 我意识到有一段时间过于具体是不够的,因为我们可能有不同的Xcode版本,我自己在同一台Mac Pro上有2个xcode版本。 So here I would like to provide a general instruction that i hope it will work for all Xcode version: 所以在这里我想提供一个通用指令,我希望它适用于所有Xcode版本:

  • My 2 versions are xcode 3.2.6 and 4.0. 我的2个版本是xcode 3.2.6和4.0。 You need to find (even google for the settings) your xcode BUILD SETTINGS and its CODE SIGNING under CODE SIGNING you have CODE SIGN IDENTITY this provide you a list of IDENTIFIERS (if you do not have IDENTIFIERS go here to get one and registration is required https://developer.apple.com/ios/manage/overview/index.action - follow this instruction of Apple "Get your application on an iOS with the Development Provisioning Assistant") If you have a list of identifiers just select a valid one and run your Xcode again. 您需要找到(甚至谷歌的设置)您的xcode BUILD SETTINGS及其CODE SIGNING下的CODE SIGNING您有CODE SIGN IDENTITY这为您提供了一个IDENTIFIERS列表(如果您没有IDENTIFIERS请到这里获取一个并且需要注册https://developer.apple.com/ios/manage/overview/index.action - 按照Apple的说明“使用Development Provisioning Assistant在iOS上获取应用程序”如果您有标识符列表,请选择有效一,再次运行你的Xcode。 It will work! 它会工作!

  • 3.2.6 specific: On your scode window - click on Project -> Project settings -> Build (tab) -> there is a scroll down because the list is long MAKING SURE you scroll down to find your CODE SIGNING section 3.2.6 specific:在您的scode窗口 - 单击Project - > Project settings - > Build(tab) - >向下滚动,因为列表很长确保您向下滚动以找到您的CODE SIGNING部分

  • 4.0 specific: On your xcode window - click on your project file left most colum -> then next colum click on your target app -> find CODE SIGNING and assign an IDENTIFIER. 4.0特定:在你的xcode窗口 - 点击你的项目文件最左列 - >然后下一个列点击你的目标应用程序 - >找到CODE SIGNING并分配一个IDENTIFIER。 It should work for you. 它应该适合你。

Done! 完成!

Most common cause, considering that all certificates are installed properly is not specifying the Code Signing Identity in the Active Target settings along with the Project settings. 考虑到所有证书都已正确安装,最常见的原因是未在“活动目标”设置中指定“代码签名标识”以及“项目”设置。 Change these from to iPhone Developer (Xcode will select the right profile depending on App ID match). 将这些更改为iPhone Developer(Xcode将根据App ID匹配选择正确的配置文件)。

  • In Xcode , change from Simulator to Device (in the dropdown at the top of the Xcode window), so that your target for application deployment will be the Device. 在Xcode中,从Simulator更改为Device(在Xcode窗口顶部的下拉列表中),以便应用程序部署的目标是Device。

  • The default ID which is a wild card ID is like a catch all iD, when associated in Code Signing (if you are using sample files to build, they will most obviously not have com.coolapps.appfile imports, in which case without the 'Team Provisioning profile', your build would fail. So you would want to set this in your 作为通配符ID的默认ID类似于捕获所有iD,当在代码签名中关联时(如果您使用示例文件构建,它们最明显没有com.coolapps.appfile导入,在这种情况下没有'团队配置配置文件',你的构建将失败。所以你想在你的设置中设置它

  • Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select 'iPhone Developer' as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * ) Xcode-> Project - > Edit Project Settings-> Build(tab) - > Code Signing Identity(header) - >任何iOS(从任何iOS模拟器更改) - >(选择'iPhone Developer'作为值,它将默认为通配符开发配置文件(Team Provisioning Profile:*)

and also (VERY IMPORTANT) 而且(非常重要)

  • Xcode->Project ->Edit Active Target ->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select 'iPhone Developer' as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * ) Xcode-> Project - > Edit Active Target - > Build(tab) - > Code Signing Identity(header) - >任何iOS(从任何iOS模拟器更改) - >(选择'iPhone Developer'作为值,它将默认为通配符开发配置文件(Team Provisioning Profile:*)

Complete steps for a beginner at: http://codevelle.wordpress.com/2010/12/21/moving-from-ios-simulator-to-the-ios-device-smoothly-without-code-sign-error/ 初学者的完整步骤: http//codevelle.wordpress.com/2010/12/21/moving-from-ios-simulator-to-the-ios-device-smoothly-without-code-sign-error/

Make sure that you have created provisioning profiles correctly.. if you did.. you must be having ... public key, private key and Certificate in Keychain Access. 确保您已正确创建配置文件..如果您这样做了..您必须拥有...公钥,私钥和Keychain Access中的证书。 CHECK if you have all these.. 检查你是否拥有这些......

XCode 3.2.4 Comes with the Auto device provisioning ... so you just have to sign in to your developers account it will download all valid profiles.. XCode 3.2.4附带自动设备配置...因此您只需登录到您的开发者帐户即可下载所有有效的配置文件。

If you have all you need in keychain and downloaded profiles... When you are selecting iPhone Developer: Aaron Milam'. 如果您拥有钥匙串和下载的配置文件中所需的一切......当您选择iPhone开发人员:Aaron Milam'时。 in build settings.. make sure you have selected Configuration ( on left top inside Target->Build ) you want to make build for. 在构建设置中..确保您已选择要构建的配置(在Target-> Build内部的左上角)。 or you can do All configuration to make changes in all available configurations ie Debug, Release etc. 或者您可以执行所有配置以在所有可用配置中进行更改,即调试,发布等。

Summarised form an answer to Xcode fails with "Code Signing" Error 摘要形式Xcode的答案失败,出现“代码签名”错误

project.pbxproj files can be merged in such a way that two CODE_SIGN_IDENTITY lines can be inserted. project.pbxproj文件可以合并为可以插入两个CODE_SIGN_IDENTITY行的方式。 Deleting one of these normally fixes the issue. 删除其中一个通常可以解决问题。

I have created simple script to help diagnose this issue it can be found here: https://gist.github.com/4339226 我创建了简单的脚本来帮助诊断这个问题,可以在这里找到: https//gist.github.com/4339226

A full answer can be found here . 完整的答案可以在这里找到。

After trying all of the above answers, and everything else I could think of from within Xcode 4.6, I fixed this with these steps: 在尝试了上述所有答案以及我在Xcode 4.6中可以想到的所有其他内容之后,我通过以下步骤修复了这个问题:

  1. Close Xcode 关闭Xcode
  2. Right-click on .xcodeproj file -> show package contents 右键单击.xcodeproj文件 - >显示包内容
  3. Edit project.xcodeproj in a text editor 在文本编辑器中编辑project.xcodeproj
  4. Search for "CODE_SIGN_IDENTITY" - there will be pairs of lines like this: 搜索“CODE_SIGN_IDENTITY” - 会有像这样的行对:
  CODE_SIGN_IDENTITY = "iPhone Developer: Joe Smith (555NN555)"; "CODE_SIGN_IDENTY[sdk=iphoneos*]" = "iPhone Developer: Joe Smith (555NN555)"; 

I found 2 targets with value like that, and 2 targets with 我找到了2个有价值的目标,2个目标有

  CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTY[sdk=iphoneos*]" = ""; 

I copied the former pair of lines over the latter pair of lines for all cases where the latter pair was emtpy. 对于后一对线是emtpy的所有情况,我将前一对线复制到后一对线上。

I then restarted Xcode, and it works fine now. 然后我重新启动了Xcode,它现在运行正常。

In my case, locking and unlocking login-keychain from Keychain Access did the trick 就我而言,从Keychain Access锁定和解锁登录密钥链就可以了 在此输入图像描述

  1. Populate " Code Signing " in both " Project " and " Targets " section 在“ 项目 ”和“ 目标 ”部分填充“ 代码签名
  2. Select valid entries in " Code Signing Identity " in both " Debug " and " Release " 在“ Debug ”和“ Release ”中的“ Code Signing Identity ”中选择有效条目
  3. Under " Debug " select you Developer certificate 在“ Debug ”下,选择Developer certificate
  4. Under " Release " select your Distributor certificate 在“ 发布 ”下,选择您的经销商证书

Following these 4 steps always solves my issues. 遵循这4个步骤总能解决我的问题。

As already mentioned here if you don't want to code sign you application you can set CODE_SIGNING_REQUIRED to NO . 如前所述,如果您不想对应用程序进行代码签名,则可以将CODE_SIGNING_REQUIRED设置为NO Here is method to do it without any project/files modification: 这是在没有任何项目/文件修改的情况下执行的方法:

Create file NoCodeSign.xcconfig : 创建文件NoCodeSign.xcconfig

CODE_SIGNING_REQUIRED = NO

Set XCODE_XCCONFIG_FILE environment variable to path to this file: XCODE_XCCONFIG_FILE环境变量设置为此文件的路径:

export XCODE_CXCONFIG_FILE=/path/to/NoCodeSign.xcconfig

Now you can build your application without code signing. 现在,无需代码签名即可构建应用程序。

Another possibility - When you Build for Archive make sure your Archive choice in your scheme is set for Distribution, not Release. 另一种可能性 - 当您构建存档时,请确保您的方案中的存档选项设置为分发,而不是发布。

Go to Product -> Edit Scheme This brings up a new dialog. 转到产品 - >编辑方案这将打开一个新对话框。

Select Archive on the left. 选择左侧的存档。 Make sure the build configuration is Distribution. 确保构建配置是分发。

I use Xcode 4.3.2, and my problem was that in there where a folder inside another folder with the same name, eg myFolder/myFolder/. 我使用Xcode 4.3.2,我的问题是在那里有一个文件夹里面有另一个同名文件夹,例如myFolder / myFolder /。

The solution was to change the second folder's name eg myFolder/_myFolder and the problem was solved. 解决方案是更改第二个文件夹的名称,例如myFolder / _myFolder,问题解决了。

I hope this can help some one. 我希望这可以帮助一些人。

Maybe your mac's date and time are incorrect. 也许你的mac的日期和时间不正确。 Just correct them. 只要纠正它们。

In file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist 在文件/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist

change the CODE_SIGNING_REQUIRED YES 更改CODE_SIGNING_REQUIRED YES

to

CODE_SIGNING_REQUIRED NO CODE_SIGNING_REQUIRED NO

Restart Xcode 重启Xcode

您是否更新了正在测试的iPhone的固件版本?

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

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