xcode 每当我尝试在新的 SceneKit 应用程序中替换库存文件时,代码签名错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37830758/
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 Signing Error Whenever I try replacing stock files in new SceneKit application
提问by Mohammad Al-Ahdal
So Xcode 8 was recently released and I'm still unsure as to what exactly might be causing this problem (it might be just the fact that it's a beta version of Xcode or perhaps that I'm somehow doing something incorrectly).
所以 Xcode 8 最近发布了,我仍然不确定到底是什么导致了这个问题(这可能只是因为它是 Xcode 的测试版,或者我不知何故做错了)。
The problem at hand is that I'm trying to create a new SceneKit application and I'm currently messing around with the .scn files.
手头的问题是我正在尝试创建一个新的 SceneKit 应用程序,而我目前正在处理 .scn 文件。
I created a .scn file, "hero.scn" inside of a "hero.scnassets" and also provided a .png file inside of the hero.scnassets folder by the name of "heroTexture.png"
我在“hero.scnassets”中创建了一个 .scn 文件,“hero.scn”,还在 hero.scnassets 文件夹中提供了一个名为“heroTexture.png”的 .png 文件
The code normally provided by Xcode 8.0 beta 1 for this project in the "GameViewController.swift" file was edited as follows:
Xcode 8.0 beta 1 通常为此项目在“GameViewController.swift”文件中提供的代码被编辑如下:
Original Code:
原始代码:
...
let scene = SCNScene(named: "art.scnassets/ship.scn")!
...
let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!
ship.run(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1)))
Edited Code:
编辑代码:
...
let scene = SCNScene(named: "hero.scnassets/hero.scn")!
...
let hero = scene.rootNode.childNode(withName: "hero", recursively: true)!
hero.run(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1)))
Error Received:
收到错误:
.../Xapp.app: resource fork, finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Conclusion of Question:
问题结论:
Why am I getting a signing error when all I've done is simply replaced files?
Sidenote: I know how to get the code signing issue to go away but that involves restarting the entire project (which I don't mind). The problem I face however is whenever I change the files, I get this error.
当我所做的只是替换文件时,为什么会出现签名错误?
旁注:我知道如何让代码签名问题消失,但这涉及重新启动整个项目(我不介意)。然而,我面临的问题是,每当我更改文件时,都会出现此错误。
回答by ecume des jours
Get rid of this build error in three easy steps:
通过三个简单的步骤摆脱这个构建错误:
1) delete the most current folder related to your app in DerivedData (~/Library/Developer/Xcode/DerivedData)
1) 在 DerivedData (~/Library/Developer/Xcode/DerivedData) 中删除与您的应用程序相关的最新文件夹
2) in the terminal, cd to the current project dir
2)在终端中,cd到当前项目目录
3) run
3)运行
xattr -rc .
xattr -rc 。
to remove all extended attributes (usually related to image files previously edited in Photoshop)
删除所有扩展属性(通常与之前在 Photoshop 中编辑过的图像文件相关)
rebuild your app!
重建您的应用程序!
回答by Mark McCorkle
The error is from attributes inside your image files.
错误来自图像文件中的属性。
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. Rebuild, clean and problem solved.
这是一个简单的命令来查找所有 png 文件并删除它们的属性。从终端在您的项目根目录中运行它。重建,清洁并解决问题。
find . -type f -name '*.png' -exec xattr -c {} \;
回答by Peter Theill
I got the resource fork, finder information, or similar detritus not allowed
error after having installed the development version of macOS and in my case it was caused by invalid attributes on some of my files.
我resource fork, finder information, or similar detritus not allowed
在安装了 macOS 的开发版本后遇到了错误,在我的情况下,它是由我的某些文件的无效属性引起的。
I fixed it by searching for com.apple.FinderInfo
attributes set on my files like this
我通过搜索com.apple.FinderInfo
在我的文件上设置的属性来修复它
ls -alR@ . > investigate.txt
ls -alR@ . > investigate.txt
Now open investigate.txt in your favorite text editor and perform a search for com.apple.FinderInfo
and clear attributes on all files having this attribute set. You can do that using
现在在您最喜欢的文本编辑器中打开调查.txt 并搜索com.apple.FinderInfo
并清除所有设置了此属性的文件的属性。你可以使用
xattr -c <filename>
e.g. xattr -c iTunesArtwork.png
xattr -c <filename>
例如 xattr -c iTunesArtwork.png
Once I cleared all my files I was able to code sign my app again.
一旦我清除了所有文件,我就可以再次对我的应用程序进行代码签名。
回答by Sophie Clark
I couldn't remove the finder info and restarting didn't work. For me (I have Sierra beta installed) it was because the project was in my Documents folder which is synced with iCloud. As soon as I made a project not in a folder synced with iCloud it worked fine, so the bug might be to do with iCloud as well/instead of with Xcode
我无法删除查找器信息并且重新启动不起作用。对我来说(我安装了 Sierra 测试版)这是因为该项目位于我的 Documents 文件夹中,该文件夹与 iCloud 同步。一旦我创建了一个不在与 iCloud 同步的文件夹中的项目,它就可以正常工作,因此该错误可能与 iCloud 以及/而不是与 Xcode 有关
回答by Mohammad Al-Ahdal
Fixed it! Apparently it was an error with the new Xcode. What you should do is restart OS X/macOS and clean the project. It should work after that!
修复!显然这是新 Xcode 的错误。您应该做的是重新启动 OS X/macOS 并清理项目。之后它应该可以工作!
回答by Lawrence Fletcher
This seems to clear up the problem. Make a .atlas folder (i.e. "myImages.atlas"), out side of the project root folder. Add your images to the .atlas folder. Then from within in the project "add files to..." the .atlas folder, (note: avoid putting the .atlas folder in the art.scnasstes folder, and make sure the project in "cleaned" before you rebuild)
这似乎解决了问题。在项目根文件夹外创建一个 .atlas 文件夹(即“myImages.atlas”)。将您的图像添加到 .atlas 文件夹。然后从项目中“将文件添加到...”中的 .atlas 文件夹,(注意:避免将 .atlas 文件夹放在 art.scnasstes 文件夹中,并在重建之前确保项目处于“已清理”状态)
回答by Kalpesh Panchasara
This is a security hardening change that was introduced with iOS 10, macOS Sierra, watchOS 3, and tvOS 10.
这是 iOS 10、macOS Sierra、watchOS 3 和 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.
代码签名不再允许应用程序包中的任何文件具有包含资源分支或 Finder 信息的扩展属性。
To see which files are causing this error, run this command in Terminal:
要查看导致此错误的文件,请在终端中运行以下命令:
$ xattr -lr
$ xattr -lr
replacing with the path to your actual app bundle.
替换为您的实际应用程序包的路径。
Here's an example of this command in action:
这是此命令的示例:
$ xattr -lr Foo.app
$ xattr -lr Foo.app
/Applications/Foo.app: com.apple.FinderInfo:
/Applications/Foo.app: com.apple.FinderInfo:
00000000 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 |................|
00000000 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 ||
You can also remove all extended attributes from your app bundle with the xattr command:
您还可以使用 xattr 命令从您的应用程序包中删除所有扩展属性:
$ xattr -cr
$ xattr -cr
Note that browsing files within a bundle with Finder's Show Package Contents command can cause Finder info to be added to those files. Otherwise, audit your build process to see where the extended attributes are being added.
请注意,使用 Finder 的 Show Package Contents 命令浏览包中的文件可能会导致将 Finder 信息添加到这些文件中。否则,审核您的构建过程以查看添加扩展属性的位置。