ios Xcode 'CodeSign 错误:需要代码签名'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3804191/
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
Xcode 'CodeSign error: code signing is required'
提问by Aaron
I've been working on an iPhone project with iOS 4.0. I just downloaded Xcode 3.2.4 with iOS SDK 4.1 so that I can work with the updated iOS. Upon opening the project in the udpated Xcode, I found that the target read 'Base SDK Missing'. I fixed that by following the instructions here.
我一直在使用 iOS 4.0 开发 iPhone 项目。我刚刚下载了带有 iOS SDK 4.1 的 Xcode 3.2.4,以便我可以使用更新的 iOS。在 udpated Xcode 中打开项目后,我发现目标读取“Base SDK Missing”。我按照此处的说明修复了该问题。
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 有我的证书,并且选择的代码签名实体是“iPhone 开发人员:Aaron Milam”。
Any ideas as to what I could be missing here?
关于我在这里可能缺少什么的任何想法?
采纳答案by Vinzius
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.
祝你好运。
回答by Gryzorz
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]
* Distribution -> don't code sign
** any iOS SDK -> [my AppStore profile]
* Release -> don't code sign
** any iOS SDK -> [my AdHoc profile]
代码签名身份 ->不代码签名
* 调试 ->不代码签名
** 任何 iOS SDK -> [我的开发者资料]
* 分发 ->不代码签名
** 任何 iOS SDK -> [我的 AppStore profile]
* 发布 ->不编码
** 任何 iOS SDK -> [我的 AdHoc 个人资料]
When I put my profiles one level above (at Debug/Ditribution/Release), it doesn't work for some reason (bug ?).
当我把我的配置文件放在上面一层(在调试/分发/发布)时,它由于某种原因不起作用(错误?)。
Hope it helps some of us !
希望它可以帮助我们中的一些人!
回答by dung
I love 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. So here I would like to provide a general instruction that i hope it will work for all Xcode version:
My 2 versions are xcode 3.2.6 and 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. 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
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. It should work for you.
我喜欢堆栈溢出:
我意识到有时过于具体是不够的,因为我们可能有不同的 Xcode 版本,我自己在同一台 Mac Pro 上有 2 个 xcode 版本。所以在这里我想提供一个一般说明,我希望它适用于所有 Xcode 版本:
我的 2 个版本是 xcode 3.2.6 和 4.0。你需要找到(甚至谷歌的设置)你的 xcode BUILD SETTINGS 和它的 CODE SIGNING 在 CODE SIGNING 你有 CODE SIGN IDENTITY 这为你提供了一个 IDENTIFIERS 列表(如果你没有 IDENTIFIERS 去这里获取一个并且需要注册https://developer.apple.com/ios/manage/overview/index.action- 按照 Apple 的说明“使用开发配置助手在 iOS 上获取应用程序”)如果您有标识符列表,只需选择一个有效的一个并再次运行您的Xcode。它会起作用!
3.2.6 具体:在您的 scode 窗口中 - 单击项目 -> 项目设置 -> 构建(选项卡)-> 向下滚动,因为列表很长确保向下滚动以找到您的代码签名部分
4.0 特定:在您的 xcode 窗口中 - 单击最左侧的项目文件 -> 然后下一栏单击您的目标应用程序 -> 找到 CODE SIGNING 并分配一个 IDENTIFIER。它应该适合你。
Done!
完毕!
回答by SheshPai
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.
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
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 中,将 Simulator 更改为 Device(在 Xcode 窗口顶部的下拉列表中),以便应用程序部署的目标将是 Device。
作为通配符 ID 的默认 ID 就像一个包罗万象的 ID,当在代码签名中关联时(如果您使用示例文件来构建,它们很明显不会有 com.coolapps.appfile 导入,在这种情况下没有 ' Team Provisioning profile',你的构建会失败。所以你想在你的
Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS(从 Any iOS Simulator 更改)->(选择“iPhone Developer”作为值,它将默认为通配符开发配置文件(团队配置文件:*)
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) ->Any iOS(从 Any iOS Simulator 更改)->(选择“iPhone Developer”作为值,它将默认为通配符开发配置文件(团队配置文件:*)
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/
回答by kthorat
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. 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'. in build settings.. make sure you have selected Configuration ( on left top inside Target->Build ) you want to make build for. or you can do All configuration to make changes in all available configurations i.e. Debug, Release etc.
如果您在钥匙串和下载的配置文件中拥有所需的一切...当您选择 iPhone 开发人员时:Aaron Milam'。在构建设置中.. 确保您选择了要构建的配置(在 Target->Build 内的左上角)。或者您可以执行所有配置以更改所有可用配置,即调试、发布等。
回答by Tibidabo
- Populate "Code Signing" in both "Project" and "Targets" section
- Select valid entries in "Code Signing Identity" in both "Debug" and "Release"
- Under "Debug" select you Developercertificate
- Under "Release" select your Distributorcertificate
- 在“项目”和“目标”部分填充“代码签名”
- 在“调试”和“发布”中选择“代码签名标识”中的有效条目
- 在“调试”下选择你的开发者证书
- 在“发布”下选择您的经销商证书
Following these 4 steps always solves my issues.
遵循这 4 个步骤总是可以解决我的问题。
回答by Richard Stelling
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. Deleting one of these normally fixes the issue.
project.pbxproj
文件可以CODE_SIGN_IDENTITY
以插入两行的方式合并。删除其中之一通常可以解决问题。
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.
完整的答案可以在这里找到。
回答by Rayfleck
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 中想到的所有其他内容之后,我通过以下步骤解决了这个问题:
- Close Xcode
- Right-click on .xcodeproj file -> show package contents
- Edit project.xcodeproj in a text editor
- Search for "CODE_SIGN_IDENTITY" - there will be pairs of lines like this:
- 关闭 Xcode
- 右键单击 .xcodeproj 文件 -> 显示包内容
- 在文本编辑器中编辑 project.xcodeproj
- 搜索“CODE_SIGN_IDENTITY” - 会有这样的几行:
CODE_SIGN_IDENTITY = "iPhone Developer: Joe Smith (555NN555)"; "CODE_SIGN_IDENTY[sdk=iphoneos*]" = "iPhone Developer: Joe Smith (555NN555)";
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*]" = "";
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.
对于后一对为空的所有情况,我将前一对线复制到后一对线上。
I then restarted Xcode, and it works fine now.
然后我重新启动了 Xcode,它现在工作正常。
回答by Rayfleck
As already mentioned here if you don't want to code sign you application you can
set CODE_SIGNING_REQUIRED
to NO
. Here is method to do it without any project/files
modification:
正如这里已经提到的,如果你不想对你的应用程序进行代码签名,你可以设置CODE_SIGNING_REQUIRED
为NO
. 这是在不修改任何项目/文件的情况下执行此操作的方法:
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.
现在,您无需代码签名即可构建应用程序。