ios Xcode 10,命令 CodeSign 失败,退出代码非零
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52421999/
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 10, Command CodeSign failed with a nonzero exit code
提问by Test Test
Everytime I build console is showing this message.
每次我构建控制台时都会显示此消息。
CodeSign /Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app (in target: Desker) cd /Users/admin/Desktop/AppStoreBuild/Project201 export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
CodeSign /Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app (in target: Desker) cd /Users/admin/Desktop/AppStoreBuild/Project201 export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/ Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "-"
签名身份:“-”
/usr/bin/codesign --force --sign - --entitlements /Users/admin/Desktop/AppStoreBuild/Project201/build/Project.build/Debug-iphonesimulator/Project.build/Project.app.xcent --timestamp=none /Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app
/Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app: resource fork, Finder information, or similar detritus not allowed Command CodeSign failed with a nonzero exit code
/Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app:资源叉、Finder信息或类似的碎屑不允许 命令CodeSign失败,退出代码非零
... Is there any way to identify the cause of this failure. It's showing Signing Identity: "-" when I try to run in simulator also. why do we need signing identity in simulator. And one more thing is if I quit Xcode and restart, it will build properly when I change code or add a method will again build failing.
... 有什么办法可以查明这个失败的原因。当我也尝试在模拟器中运行时,它显示签名身份:“-”。为什么我们需要在模拟器中签署身份。还有一件事是,如果我退出 Xcode 并重新启动,它会在我更改代码或添加方法时再次构建失败时正确构建。
回答by omanosoft
I had that problem and Xcode failed to compile on the device, but on simulator, it worked fine.
我遇到了这个问题,Xcode 无法在设备上编译,但在模拟器上,它运行良好。
I solved with these steps:
我通过以下步骤解决了:
- Open keychain access.
- Lock the 'login' keychain.
- Unlock it, enter your PC account password.
- Clean Project in the product menu.
- Build it Again.
- 打开钥匙串访问。
- 锁定“登录”钥匙串。
- 解锁它,输入您的PC帐户密码。
- 产品菜单中的 Clean Project。
- 再建一次。
And after that everything works fine.
之后一切正常。
回答by Paul Slocum
None of the listed solutions worked for me. In another threadit was pointed out that including a folder named "resources" in the project causes this error. After renaming my "resources" folder, the error went away.
列出的解决方案都不适合我。 在另一个线程中指出,在项目中包含一个名为“resources”的文件夹会导致此错误。重命名我的“资源”文件夹后,错误消失了。
回答by xuzepei
If you also get code signing fails with the error "resource fork, Finder information, or similar detritus not allowed."
如果您还收到代码签名失败并显示错误“不允许资源分叉、Finder 信息或类似的碎屑”。
Run script below in console to fix:
在控制台中运行下面的脚本来修复:
$ xattr -cr <path_to_app_bundle>
回答by Jonas
This happened to me just today, only after I added a .png image with 'hide extension' ticked in the get info. (Right click image) Ths image was added to the file directory of my Xcode project.
就在今天,这发生在我身上,只有在我添加了一个在获取信息中勾选了“隐藏扩展名”的 .png 图像之后。(右键单击图像)该图像已添加到我的 Xcode 项目的文件目录中。
When unticked box and re-adding the the .png image to directory of Xcode, I then Cleaned and Built and worked fine after that, a very strange bug if you ask me.
当取消勾选框并将 .png 图像重新添加到 Xcode 目录时,我然后清理和构建并在此之后工作正常,如果你问我,这是一个非常奇怪的错误。
回答by Md Rashed Pervez
Try cleaning the project:
尝试清理项目:
1. shift + cmd + k
2. shift + cmd + Alt + k
Then try to run your project again. Hope this will fix the problem.
然后尝试再次运行您的项目。希望这能解决问题。
回答by plamenti
This issue happened to me after adding .dae and .png files and converting .dae with XCode Editor to SceneKit scene file format (.scn).
在添加 .dae 和 .png 文件并将 .dae 与 XCode Editor 转换为 SceneKit 场景文件格式 (.scn) 后,这个问题发生在我身上。
After doing some more research I found the solution here - https://forums.developer.apple.com/thread/109951#336225
在做了更多研究之后,我在这里找到了解决方案 - https://forums.developer.apple.com/thread/109951#336225
Steps to solve the issue:
解决问题的步骤:
- In XCode go to Preferences
- Click on Locations tab
- In Command Line Tools select from the drop down XCode 10.1
- 在 XCode 中转到首选项
- 单击位置选项卡
- 在命令行工具中,从下拉菜单中选择 XCode 10.1
回答by Faustino Gagneten
The solution for me was restarting macOS without saving
我的解决方案是在不保存的情况下重新启动 macOS
回答by Val
In Xcode: Go to Preferences Logout of the current user.
在 Xcode 中:转到当前用户的首选项注销。
Close Xcode
关闭 Xcode
In Keychain: Go to Login and All items
在钥匙串中:转到登录和所有项目
- Sort by kind
- remove "Apple Worldwide Developer Relation Certification Authority"
- remove "Developer ID Certification Authority"
- remove "iPhone Developer ...."
Open Xcode
打开 Xcode
Go to Preferences and Login to you user apple account
转到首选项并登录到您的用户 Apple 帐户
- This will reload your developer certificates you previous deleted Rebuild the project (Should be a successful build)
- 这将重新加载您之前删除的开发人员证书 重新构建项目(应该是成功构建)
Run the build on your native device
在您的本机设备上运行构建
回答by Madji
In my case was the following errors lines:
在我的情况下是以下错误行:
Signing Identity: "-"
…..mobile.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
签名身份:“-”
.....mobile.app:不允许资源分叉、Finder 信息或类似的碎屑
命令 CodeSign 失败,退出代码非零
the problem was that in the resources folder I had some files with .png extension, which was hidden on the defaults.
问题是在资源文件夹中,我有一些扩展名为 .png 的文件,这些文件在默认设置中是隐藏的。
Find file in FINDER, mark it -> cmd+i -> unchek Hide extension
在 FINDER 中查找文件,标记 -> cmd+i -> 取消选中隐藏扩展名
after that, return in Xcode -> kmd + shift + K and rebuild.
之后,返回 Xcode -> kmd + shift + K 并重建。
I hope I've been helpful!
我希望我有帮助!
回答by paul_f
I'm unsure of what causes this issue but one method I used to resolve the porblem successfully was to run pod update on my cocoa pods.
我不确定是什么导致了这个问题,但我用来成功解决问题的一种方法是在我的可可豆荚上运行 pod update。
The error (for me anyway) was showing a problem with one of the pods signing. Updating the pods resolved that signing issue.
错误(无论如何对我来说)显示其中一个 pod 签名存在问题。更新 pod 解决了该签名问题。
pod update [PODNAME] //For an individual pod
or
或者
pod update //For all pods.
Hopefully, this will help someone who is having the same "Command CodeSign failed with a nonzero exit code" error.
希望这能帮助那些遇到相同“命令代码签名失败,退出代码非零”错误的人。