您如何修复 Xcode 6、Mac OS X Yosemite 或 Mavericks 中的“代码对象根本未在子组件中签名:”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29076321/
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
How do you fix "code object is not signed at all In subcomponent:" in Xcode 6, Mac OS X Yosemite or Mavericks?
提问by pupeno
When compiling my application I'm getting the following error:
编译我的应用程序时,我收到以下错误:
CodeSign /Users/pupeno/Library/Developer/Xcode/DerivedData/ProjectX-cynmgyozflnwbpamwnpsnhgshuyq/Build/Products/Debug/Project\ X.app
cd /Users/pupeno/Projects/ProjectX
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "Mac Developer: José Fernández (G4PM7K38JH)"
/usr/bin/codesign --force --sign A21FB31766DDCBB28FBB4E4DD86E3743024A45F3 --entitlements /Users/pupeno/Library/Developer/Xcode/DerivedData/ProjectX-cynmgyozflnwbpamwnpsnhgshuyq/Build/Intermediates/ProjectX.build/Debug/App.build/Project\ X.app.xcent --requirements =designated\ =>\ anchor\ apple\ generic\ \ and\ identifier\ \"$self.identifier\"\ and\ ((cert\ leaf[field.1.2.840.113635.100.6.1.9]\ exists)\ or\ (\ certificate\ 1[field.1.2.840.113635.100.6.2.6]\ exists\ and\ certificate\ leaf[field.1.2.840.113635.100.6.1.13]\ exists\ \ and\ certificate\ leaf[subject.OU]\ =\ \"XHT4M2DATL\"\ )) /Users/pupeno/Library/Developer/Xcode/DerivedData/ProjectX-cynmgyozflnwbpamwnpsnhgshuyq/Build/Products/Debug/Project\ X.app
/Users/pupeno/Library/Developer/Xcode/DerivedData/ProjectX-cynmgyozflnwbpamwnpsnhgshuyq/Build/Products/Debug/Project X.app: code object is not signed at all
In subcomponent: /Users/pupeno/Library/Developer/Xcode/DerivedData/ProjectX-cynmgyozflnwbpamwnpsnhgshuyq/Build/Products/Debug/Project X.app/Contents/Frameworks/Paddle.framework
Command /usr/bin/codesign failed with exit code 1
I'm using two frameworks, Paddle and Sparkle and they are configured to sign on copy:
我正在使用两个框架,Paddle 和 Sparkle,它们被配置为在副本上签名:
Looking for a solution to this problem I found many recommendations to do a --deep sign, which is officially discouraged by Apple (Using the codesign Tool's --deep Option Correctly).
在寻找这个问题的解决方案时,我发现了很多关于做 --deep 标志的建议,这是 Apple 官方不鼓励的(正确使用代码设计工具的 --deep 选项)。
I also found the article Code Signing and Maverickswhich also explains that using --deep is wrong and offers an alternative: using a script to generate signatures for each framework. I think this is something that was needed before Xcode had the option to sign on copy, but I gave it a try anyway. It made no difference, I still get the same error. Looking at the logs, the bundles are getting signed with the "Sign on copy" option, so, adding that script caused them to get signed twice.
我还找到了Code Signing and Mavericks文章,它也解释了使用 --deep 是错误的,并提供了一种替代方法:使用脚本为每个框架生成签名。我认为这是在 Xcode 可以选择在副本上签名之前需要的东西,但我还是试了一下。它没有区别,我仍然遇到相同的错误。查看日志,捆绑包正在使用“在复制时签名”选项进行签名,因此,添加该脚本会导致它们被签名两次。
My code signing identity is configured as follows for the whole project and each target just inherits it:
我的代码签名身份为整个项目配置如下,每个目标只是继承它:
I understand that's not the appropriate signature for Release, but for now, we are just trying to get this to build and run locally.
我知道这不是 Release 的合适签名,但就目前而言,我们只是试图让它在本地构建和运行。
Any ideas what's wrong? Any ideas how to fix it? I understand that
任何想法有什么问题?任何想法如何解决它?我明白那个
采纳答案by pupeno
The problem was that the Framework, Paddle.framework, became corrupt. The symlinks were resolved to the files they were pointed to, so, compilation worked just fine, but signing didn't.
问题在于框架 Paddle.framework 已损坏。符号链接被解析为它们指向的文件,因此,编译工作得很好,但签名却没有。
Re-downloading the framework and copying it into the project fixed the problem.
重新下载框架并将其复制到项目中解决了问题。
回答by Bisca
For me the solution was to re-Add a resource folder (checking Create groups instead of create folder references).
对我来说,解决方案是重新添加一个资源文件夹(检查创建组而不是创建文件夹引用)。
回答by BaptisteB
For me I had to go to the Project build settings and set Other Code Signing Flags to --deep
. The problem was that my framework in the project was not signed.
对我来说,我必须转到项目构建设置并将其他代码签名标志设置为--deep
. 问题是我在项目中的框架没有签名。
回答by Brett Terpstra
I'll admit codesigning is still a black art to me, but in Xcode 6 I found that removing allof my signing scripts (which were necessary in Xcode 5, along with --deep
flags) and additional signing flags, and just using the "codesign on copy"option in the Framework's Copy Files phase of the build worked flawlessly for me.
我承认代码对我来说仍然是一门黑色艺术,但在 Xcode 6 中,我发现删除我所有的签名脚本(在 Xcode 5 中是必需的,以及--deep
标志)和额外的签名标志,并且只使用“codesign on构建的框架的复制文件阶段中的“复制”选项对我来说完美无缺。
回答by Satendra dagar
For All who still are facing this issue, Please make sure 'Product Name' in build setting matches with 'Executable file' set in info.plist.
对于所有仍然面临此问题的人,请确保构建设置中的“产品名称”与 info.plist 中设置的“可执行文件”匹配。
Generally when we duplicate exiting code, we simply change either product name or Executable file, and this mismatched creates a issue.
回答by johnboiles
For me, it turned out that I had inadvertently added a bash build script to the target. Making sure I had no sneaky scripts accidentally copied into the target fixed the issue.
对我来说,结果是我无意中向目标添加了一个 bash 构建脚本。确保我没有意外复制到目标中的偷偷摸摸的脚本解决了这个问题。
回答by Little Watchman
for me, one of the frameworks I was including, had another of the frameworks marked as "embed and sign"... which you can't do... only the app should be doing that. marking the grandchild framework as "do not embed" in the child framework, removed this issue.
对我来说,我包含的其中一个框架将另一个框架标记为“嵌入和签名”......你不能这样做......只有应用程序应该这样做。将孙框架标记为“不嵌入”在子框架中,消除了这个问题。