Xcode 8 can't archive “Command /usr/bin/codesign failed with exit code 1” part 2

I continue to have the problem that Geezus wrote about here:

https://forums.developer.apple.com/message/178039#178039


And although part of the problem is resolved by KMT's suggestion to

Try:

execute "xattr -rc ." both in DerivedData directory and Project directory


That workaround only works for me when I'm building for a simulator or attached device.


But when I try to Archive so I can load to TestFlight/iTunes Conect, the origianl problem persists:

resource fork, Finder information, or similar detritus not allowed

Command /usr/bin/codesign failed with exit code 1


I understand the original thread is closed, but since I'm still having trouble, I hope someone can offer additional help.

Replies

I may have discovered the culprit.


In my Target's Build Phases > Copy Bundle Resources, I have Images.xcassets. I'd added a new size of Icon recently.


Since I'd read that some people had "detritus" trouble regarding images, I tried executing "xattr -rc ." in DerivedData directory and Project directory AND the Images.xcassetts directories in my project source, and my Archive succeeded!


I'm no expert so I could be compleletly wrong, but seems the problematic attribute on the files in the DerivedData & Project directory causes the Code Sign error for builds to simulator and attached device but it wasn't until the Archive process that the Image.xcassetts attributes caused the issue.


I hope this saves someone some time!

Good info, thanks. Note an 'option-clean build folder' removes the folder, vs. clearing out just the one attached to a given target, so it may be that it would have done the same.

I've still got this problem even after running xattr -rc on all 3 of the directories you mention.

We should not have to use Terminal to fix this crap. Apple needs to do better quality control/testing before releasing products.

I had the same issue. I have my Project Folder in Dropbox. After copying the whole folder to a new location (outside Dropbox) everything works normal. Maybe it helps in general to COPY all files to a new location as they are "resaved" in Sierra + I removed all not used resources in my project I had one resource that was not active and the file was missing.. you can try both.

This is SO annoying. You'd think Xcode could remove the "detritus" on its own. Anyway I went to the root folder of my project in the Terminal and executed the following command to fix it "brute force":


find . -type f -exec xattr -c {} \;

Ever got it to work? I can build to device by using the method. But when archiving it still will not let me do it. I have to archive on an old machine without Sierra on at the moment. The workflow is completely broken!

It worked once but now the problem has returned and I have no idea what is wrong!

That's an interesting observation. I had the same issue for my unit tests after upgrade to Sierra.

resource fork, Finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1

In my case the xattr -rc . didn't resolve the issue.

After a lot of trial and error and even more hair-pulling, I remembered that Sierra started syncing my Documents folder where I kept my projects to the iCloud, and I keep my DerivedData relative to the project path. Sure enough, when I changed that back to the default location under ~/Library/... the issue went away. When I switch it back to any directory that is synced to the iCloud the issue re-appears. It seems that something in Sierra, possibly related to the sync process, is marking files or directories with extended attributes.

Hope that may help someone.

Thank you...I'd spent a couple of hours working this problem before I stumbled upon your post. As I read it, it occured to me that just before the "Command /usr/bin/codesign failed with exit code 1" error, I'd added a file to my project's scnassets.


Thank you again.

Thanks for your response on moving out of the dropbox path.

This raises the question of whether xcode will be compatible with dropbox anymore. All of my projects are in my dropbox path which is how I sync across macs.

Moving files in and out of dropbox to build projects will be a maintenance nightmare. I hope this can be resolved.