ios macOS High Sierra Xcode 中的代码签名错误 - 不允许资源分叉、Finder 信息或类似的碎屑
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39652867/
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
Code Sign Error in macOS High Sierra Xcode - resource fork, Finder information, or similar detritus not allowed
提问by iPhoneProcessor
Already tried : Code Sign Error on macOS Sierra, Xcode 8
已经尝试过:macOS Sierra 上的代码签名错误,Xcode 8
Please see image showing error
CodeSign /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
cd "/Volumes/Development/Project/Top Best Games/19. Lets Flow/35/let's FLOW - source/proj.ios_mac"
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "iPhone Distribution: New Free Games (2CHN583K4J)"
Provisioning Profile: "Super Flow Flipp AppStore"
(c6c30d2a-1025-4a23-8d12-1863ff684a05)
/usr/bin/codesign --force --sign E48B98966150110E55EAA9B149F731901A41B37F --entitlements /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Intermediates/Flow.build/Debug-iphoneos/Super\ Flow\ Flip.build/Super\ Flow\ Flip.app.xcent --timestamp=none /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
/Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super Flow Flip.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
In Code Sign section its allowing me to select profile and certificate...but still giving error.
在代码签名部分,它允许我选择配置文件和证书......但仍然出现错误。
How to fix this problem ?
如何解决这个问题?
回答by Guru
Solution 1:
解决方案1:
Apple Developer Website Answers above problem Here.
苹果开发者网站在此处回答上述问题。
Execute below command in terminal : First goto projects root folder
在终端中执行以下命令:首先转到项目根文件夹
xattr -cr <path_to_project_dir>
Clean Xcode and Re Build. Cheers
清理 Xcode 并重新构建。干杯
Solution 2:
解决方案2:
Just go to project root directory and run this command xattr -cr .
只需转到项目根目录并运行此命令 xattr -cr 。
xattr -cr .
Clean Xcode and Re Build. Done.
清理 Xcode 并重新构建。完毕。
Solution 3:
解决方案3:
You can fix this problem by finding files which holds finder information.
您可以通过查找包含查找程序信息的文件来解决此问题。
In terminal, goto project root directory and execute
在终端中,转到项目根目录并执行
ls -alR@ . > kundapura.txt
This creates kundapura.txt in current directory. Now search for com.apple.FinderInfo and clear this attributes for all files. You can do it like this
这将在当前目录中创建 kundapura.txt。现在搜索 com.apple.FinderInfo 并清除所有文件的此属性。你可以这样做
xattr -c <filename>
Example: xattr -c guru.png
例子: xattr -c guru.png
Once you clear all then code sign works. Clean Xcode and Re Build. Cheers
一旦你清除所有然后代码签名工作。清理 Xcode 并重新构建。干杯
Solution 4:Inspired by Mark McCorkle's Answer
解决方案 4:受 Mark McCorkle 的回答启发
In terminal, goto project's root directory and execute one by one command
在终端中,进入项目的根目录并执行一条命令
find . -type f -name '*.jpeg' -exec xattr -c {} \;
find . -type f -name '*.jpg' -exec xattr -c {} \;
find . -type f -name '*.png' -exec xattr -c {} \;
find . -type f -name '*.json' -exec xattr -c {} \;
Clean Xcode and Re Build. Done.
清理 Xcode 并重新构建。完毕。
回答by Mark McCorkle
The error is from attributes inside your image files. This happened from our graphics designer saving images from photoshop with attributes.
错误来自图像文件中的属性。这发生在我们的图形设计师从带有属性的 Photoshop 中保存图像时。
Here is a simple command to find all of your png files and remove their attributes. Run this in your projects root directory from terminal. Clean and rebuild; problem solved.
这是一个简单的命令来查找所有 png 文件并删除它们的属性。从终端在您的项目根目录中运行它。清理和重建;问题解决了。
find . -type f -name '*.png' -exec xattr -c {} \;
回答by Arnold Roa
If you have this error when codesigning an app:
如果您在对应用程序进行代码设计时遇到此错误:
resource fork, Finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1
不允许资源叉、Finder 信息或类似的碎屑命令 /usr/bin/codesign failed with exit code 1
Go to your project root folder and execute
转到您的项目根文件夹并执行
find . | xargs -0 xattr -c
This will clear attributes for all files.
这将清除所有文件的属性。
In Sierra, the rules on what can be in a signed bundle have been tightened, and resource forks are no longer allowed. AppleScript has been saving information in resource forks forever, although that information has been unused for a long time. With Sierra, when you save a script, this resource fork information will no longer be saved.
在 Sierra 中,关于签名包中可以包含哪些内容的规则已经收紧,并且不再允许资源分叉。AppleScript 一直在资源分支中永久保存信息,尽管该信息已被长期使用。使用 Sierra,当您保存脚本时,将不再保存此资源分叉信息。
It means you cannot codesign a script that was last saved in a version before Sierra; you have to save in Sierra to be able to sign in Sierra.
这意味着您不能对最后保存在 Sierra 之前版本中的脚本进行编码;您必须在 Sierra 中保存才能登录 Sierra。
The people likely to be affected by are who bundle other scripts within their scripts (cordova?). They will not be able to sign the container script until all the embedded scripts have been resaved under Sierra.
可能受到影响的人是在他们的脚本中捆绑其他脚本的人(cordova?)。在所有嵌入的脚本在 Sierra 下重新保存之前,他们将无法签署容器脚本。
UPDATE:
更新:
Seems like this also works:
似乎这也有效:
xattr -rc .
If you have any insufficient permissions error try to prepend sudo: sudo xattr -rc .
如果您有任何权限不足的错误,请尝试添加 sudo: sudo xattr -rc .
回答by A.Badger
The easiest way to handle attributes on your source files is to have Xcode clear up the archive before it runs codesign. To do this:
处理源文件属性的最简单方法是让 Xcode 在运行 codesign 之前清除存档。去做这个:
- Select your target in XCode
- Select the Build Phases tab
- Press the + symbol
- Select New Run Script Phase
Enter the following for the script:
xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear
- 在 XCode 中选择你的目标
- 选择构建阶段选项卡
- 按 + 符号
- 选择新的运行脚本阶段
为脚本输入以下内容:
xattr -cr ~/Library/Developer/Xcode/DerivedData || 回声清除
Now when you build your target it will clear out any attributes that would have broken codesign. By clearing out at this stage you don't have to alter your source code / project directory.
现在,当您构建目标时,它将清除任何可能破坏协同设计的属性。通过在此阶段清除,您不必更改源代码/项目目录。
The "|| echo Clear" part of the script ensures that the project build continues even if xattr errors.
脚本的“|| echo Clear”部分确保即使 xattr 出现错误,项目构建也会继续。
This method is good if you use programs such as DropBox on your code repository that add the attributes, as it doesn't change your source project, only the built archive.
如果您在添加属性的代码存储库中使用诸如 DropBox 之类的程序,则此方法很好,因为它不会更改您的源项目,只会更改构建的存档。
You may need to change the path to match your DerivedData directory - this path will be shown next to the codesign error.
您可能需要更改路径以匹配您的 DerivedData 目录 - 此路径将显示在协同设计错误旁边。
回答by Ram G.
I have used following command. Use terminal window. Navigate to your Project and execute following:
我使用了以下命令。使用终端窗口。导航到您的项目并执行以下操作:
xattr -rc .
回答by comrade
There is official Apple answer for this issue in Technical Q&A QA1940.
Apple 在Technical Q&A QA1940 中有对此问题的官方回答。
This is a security hardening change that was introduced with iOS 10, macOS Sierra, watchOS 3, and tvOS 10.
Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.
To see which files are causing this error, run this command in Terminal:
xattr -lr <path_to_app_bundle>
You can also remove all extended attributes from your app bundle with the xattr command:
xattr -cr <path_to_app_bundle>
这是 iOS 10、macOS Sierra、watchOS 3 和 tvOS 10 中引入的安全强化更改。
代码签名不再允许应用程序包中的任何文件具有包含资源分支或 Finder 信息的扩展属性。
要查看导致此错误的文件,请在终端中运行以下命令:
xattr -lr <path_to_app_bundle>
您还可以使用 xattr 命令从应用程序包中删除所有扩展属性:
xattr -cr <path_to_app_bundle>
<path_to_app_bundle>
can be replaced with directory of your Xcode project. For example ~/Development/MyProject
<path_to_app_bundle>
可以替换为 Xcode 项目的目录。例如~/Development/MyProject
回答by ingconti
All about clearing files is fine, but tedious for multiple projects.
关于清除文件的一切都很好,但对于多个项目来说很乏味。
graphics apps, (like photoshop in old versions) write additional info (we now call it metadata..) in an old fashion in external files, or they came frm older OSX, files like:
图形应用程序(如旧版本中的 photoshop)以旧方式在外部文件中写入附加信息(我们现在称其为元数据..),或者它们来自较旧的 OSX,文件如下:
"com.apple.ResourceFork" and "com.apple.FinderInfo", when unzipping folder, for example.
例如,“com.apple.ResourceFork”和“com.apple.FinderInfo”,当解压文件夹时。
Xcode 8 refuses to add it to a build (as You added them to a project with a "git --add ." maybe..) You can find in terminal recursively and delete them, but can be tedious.
Xcode 8 拒绝将其添加到构建中(因为您使用“git --add”将它们添加到项目中。也许……)您可以在终端中递归查找并删除它们,但可能很乏味。
I wrote a small free utility to delete it.. hope it can help..
我写了一个小的免费实用程序来删除它..希望它可以帮助..
https://itunes.apple.com/us/app/cleandetritus/id1161108431?ls=1&mt=12
https://itunes.apple.com/us/app/cleandetritus/id1161108431?ls=1&mt=12
回答by Abdu
Simple solution:-
简单的解决方案:-
How I did[Working for me]
我是怎么做的[为我工作]
Step 1:- Go to this folder - from your finder press option Go - > Go to Folder
第 1 步:- 转到此文件夹 - 从您的查找器中按选项 Go - > Go to Folder
then type your project path like this example:- Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
然后像这个例子一样输入你的项目路径:- Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now you can see a window pop with list of available File, There you see yourApp.app file [ Don't do anything just wait for step 2].
现在您可以看到一个带有可用文件列表的窗口弹出,在那里您会看到 yourApp.app 文件 [不要做任何事情,等待第 2 步]。
Step 2:- Open new Terminal and type just cd then just drag step 1 yourApp.app to terminal, now you will get the path for the app, now press enter button.
第 2 步:- 打开新终端并输入 cd 然后将第 1 步 yourApp.app 拖到终端,现在您将获得应用程序的路径,现在按 Enter 按钮。
Step 3:- Now type this command **
第 3 步:- 现在输入此命令 **
xattr -rc .
xattr -rc 。
Don't miss "."(Dot) press enter button.
不要错过“。”(点)按回车键。
That's it, Go to your Xcode project and clean and run again.
就是这样,转到您的 Xcode 项目并清理并再次运行。
回答by Bobjt
For those (like me) who are just trying to develop an app without having to strip extended attributes on every new photoshop created PNG added to the macOS target, you can temporarily disable code signing by adding a user defined build setting:
对于那些只是想开发应用程序而不必剥离添加到 macOS 目标的每个新 Photoshop 创建的 PNG 的扩展属性的人(如我),您可以通过添加用户定义的构建设置来暂时禁用代码签名:
CODE_SIGNING_ALLOWED = No
Obviously, one distributing an app needs to eventually deal with the issue but this enables development in cases like mine where it wasn't necessarily straightforward to omit code signing in Sierra (on past OS X / Xcode it was easier to do so).
显然,分发应用程序的人最终需要处理这个问题,但这使得在像我这样的情况下进行开发,在 Sierra 中省略代码签名并不一定直接(在过去的 OS X / Xcode 上,这样做更容易)。
Per RGriffith's comment, here are a few screenshots for those who aren't sure how the custom build setting is added.
根据 RGriffith 的评论,这里有一些屏幕截图,供不确定如何添加自定义构建设置的人使用。
回答by Fawkes
-----In case you can't apply the solutions above, because of lack of bash knowledge or something else.
-----如果您由于缺乏 bash 知识或其他原因而无法应用上述解决方案。
I had this problem as soon as I enabled iCloud Drive on my Sierra. And my project was in a folder which was synced with iCloud Drive. I suppose this is what adds those additional attributes.
我在 Sierra 上启用 iCloud Drive 后就遇到了这个问题。我的项目位于与 iCloud Drive 同步的文件夹中。我想这就是添加这些附加属性的原因。
Temporary solution:
临时解决方案:
Disable iCloud Drive for the folder where your project is.
为项目所在的文件夹禁用 iCloud Drive。