25

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).

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.

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"

The code normally provided by Xcode 8.0 beta 1 for this project in the "GameViewController.swift" file was edited as follows:

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.

P.S: Here's a file structure just for ease.FileStruct

Mohammad Al-Ahdal
  • 758
  • 2
  • 8
  • 21
  • see: http://stackoverflow.com/questions/39652867/code-sign-error-in-macos-sierra-xcode-8-resource-fork-finder-information-or/40055759#40055759 – ingconti Oct 15 '16 at 06:31

7 Answers7

110

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)

2) in the terminal, cd to the current project dir

3) run

xattr -rc .

to remove all extended attributes (usually related to image files previously edited in Photoshop)

rebuild your app!

ecume des jours
  • 2,493
  • 1
  • 19
  • 15
17

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.

find . -type f -name '*.png' -exec xattr -c {} \;
Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42
  • 1
    Man xCode is so vague. I wish things like this were self explanatory, I spent about 2 hours fussing with provisioning profiles and signing certificates on the developer site when the error states its a code signing issue, it is really an image attributes issue! WTF Apple! We need better debug messages... – Paul Oct 05 '16 at 21:19
  • 1
    Worth mentioning that for me, I had to clean my `~/Library/Developer/Xcode/DerivedData/` and also cleaned with `cmd+k`. Only then it worked. Thanks for the easy solution Mark! – Roger Oba Oct 05 '16 at 23:32
9

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.

I fixed it by searching for com.apple.FinderInfo attributes set on my files like this

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

xattr -c <filename> e.g. xattr -c iTunesArtwork.png

Once I cleared all my files I was able to code sign my app again.

Peter Theill
  • 3,117
  • 2
  • 27
  • 29
1

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!

Mohammad Al-Ahdal
  • 758
  • 2
  • 8
  • 21
1

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

1

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)

1

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

replacing with the path to your actual app bundle.

Here's an example of this command in action:

$ xattr -lr Foo.app

/Applications/Foo.app: com.apple.FinderInfo:

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 -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.

Kalpesh Panchasara
  • 1,730
  • 2
  • 15
  • 27