在协同设计期间更新 Xcode 会产生错误“无法在磁盘上找到代码对象”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18768819/
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
Updating Xcode yields error "cannot find code object on disk" during codesigning
提问by Alfie Hanssen
I just updated to the newest version of Xcode and encountered an error while running our automated build scripts (they use the xcodebuild
and xcrun
commands).
我刚刚更新到最新版本的 Xcode,在运行我们的自动构建脚本时遇到错误(它们使用xcodebuild
和xcrun
命令)。
The error occurs immediately after the ### Codesigning '/Users/...
log statement and looks like this:
该错误在### Codesigning '/Users/...
log 语句之后立即发生,如下所示:
Program /usr/bin/codesign returned 1 : [/var/folders/__/63j90nkn2lg18ct1nq791_nc0000gn/T/g5hbigh1tM/Payload/CurrentTarget.app: replacing existing signature
/var/folders/__/63j90nkn2lg18ct1nq791_nc0000gn/T/g5hbigh1tM/Payload/CurrentTarget.app: cannot find code object on disk
I found docs herelisting and briefly describing the error but no specifics about how to resolve it.
我发现这里的文档列出并简要描述了错误,但没有详细说明如何解决它。
Because I spent far too long looking for the resolution to this (nothing on S.O.) I'm going to post the answer below in case others encounter the same problem.
因为我花了太长时间寻找解决方案(SO 上没有任何内容),所以我将在下面发布答案,以防其他人遇到同样的问题。
回答by Alfie Hanssen
It's worth noting that you may need to update the environment variable that specifies the location of codesign_allocate:
值得注意的是,您可能需要更新指定 codesign_allocate 位置的环境变量:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
But the real solution for me came from here:
但对我来说真正的解决方案来自这里:
ln -s /usr/bin/codesign_allocate /Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate
Hope this saves someone some time...
希望这可以节省一些时间......
回答by William Denniss
I had this error when running a build script on XCode 4.5 (installed at /Applciations/XCode4_5), with XCode 5 installed more recently (in the main dev directory at /Applications/XCode) so that I can still target the iOS 6 SDK on an older project when needed.
我在 XCode 4.5(安装在 /Applciations/XCode4_5)上运行构建脚本时遇到此错误,最近安装了 XCode 5(在 /Applications/XCode 的主开发目录中),以便我仍然可以将 iOS 6 SDK 定位在需要时的旧项目。
I had previously applied the workaround mentioned in https://stackoverflow.com/a/18768869/72176to my build script, by exporting the CODESIGN_ALLOCATE
environment variable.
我之前通过导出环境变量将https://stackoverflow.com/a/18768869/72176 中提到的解决方法应用于 我的构建脚本CODESIGN_ALLOCATE
。
In this recent instance of this problem, I actually fixed it by removingthe old workaround. So my advice: if you get this error recently, and you've previously applied the workaround: try unapplying it and see if that helps!
在这个问题的最近实例中,我实际上通过删除旧的解决方法来修复它。所以我的建议是:如果您最近收到此错误,并且您之前已经应用了解决方法:尝试取消应用它,看看是否有帮助!
回答by l --marc l
The cannot find code object on disk
error occurred on two of my projects after an update to Xcode 9.3.
在cannot find code object on disk
一个更新的Xcode 9.3后我的两个项目中发生的错误。
Case 1:The issue was found to be CODE_SIGN_IDENTITY -
.
案例 1:发现问题是 CODE_SIGN_IDENTITY -
。
The fix was to change -
to something specific.
解决方法是更改-
为特定的内容。
In the Xcode Project Inspector, "Code Signing Identity" becomes either Don't Code Sign
or some code sign identity.
在 Xcode Project Inspector 中,“Code Signing Identity”成为其中一个Don't Code Sign
或某个代码签名标识。
Thus CODE_SIGN_IDENTITY
"-"
becomes either ""
(to not code sign) or a specific code sign identity.
因此CODE_SIGN_IDENTITY
"-"
成为""
(非代码符号)或特定代码符号标识。
Case 2:When using the Swift 4.1 development snapshottoolchain, the solution was to add a .xcconfig
Configurations Settings File to the Xcode project. The default CODESIGN_ALLOCATE
was set to the swift-4.1-DEVELOPMENT-SNAPSHOT-….xctoolchain/usr/bin path which does not contain the codesign_allocate
executable. The .xcconfig
can expressly set CODESIGN_ALLOCATE
for the build.
案例 2:使用 Swift 4.1开发快照工具链时,解决方案是向.xcconfig
Xcode 项目添加配置设置文件。默认CODESIGN_ALLOCATE
设置为不包含codesign_allocate
可执行文件的 swift-4.1-DEVELOPMENT-SNAPSHOT-....xctoolchain/usr/bin 路径。该.xcconfig
可以明确地CODESIGN_ALLOCATE
为构建。
example.xcconfig
例子.xcconfig
// file: example.config
CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate