I've got a serious problem on Xcode 8 on macOS Sierra. when I try to build my app, I get the following issue.
CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app
cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode
export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "-"
/usr/bin/codesign --force --sign - --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app
/Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
then I did https://forums.developer.apple.com/thread/48905 in the terminal as the following and it worked. but once I clean, the issue comes back.
cd /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp
ls -al@ *
xattr -c *
and this solution doesn't work for archive with the following issue. is there any solution for it?
CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode
export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "iPhone Developer: My Name (**********)"
Provisioning Profile: "iOS Team Provisioning Profile: com.**********.*********"
(********-****-****-****-************)
/usr/bin/codesign --force --sign **************************************** --entitlements /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
/Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
There is a more permanent fix for this. Fixing the attributes in the DerivedData works, but the problem keeps coming back. What you need to do is go to the directory shown when you get the 'resource fork, Finder information, or similar detritus not allowed', the one that contains the .App file. Then execute...
xattr -lr MyAppName.App
You can then see the resource files that have the attributes that need removing. Don't remove them from the .App file though, find the original files in your project and open the directory that contains them and execute...
xattr -rc .
This then fixes the ORIGINAL files. Rebuild should then function ok. It should also then rebuild properly for archive too.
Solution 1:
You can try file specific bash command like Mark McCorkle answered.
In terminal, goto project's root directory and execute one by one command
Clean Xcode and Re Build. Done.
Solution 2:
You can fix this problem by finding files which holds finder information.
In terminal, goto project root directory and execute
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
Once you clear all then you are able to code sign. Cheers
I found this solution in the Apple forum
or
For me worked this:
And then rebuild
I want to show my answer because it may be of interest (I have wasted a lot of time with this error)
None of the previous answers (which have a high score) have been useful to me.
They may be correct, but they haven't solved my problem.
Origin:
I added a new Target to my iOS application: iMessage
When I added png images to the Assets. xcassets, the error occurred.
Solution:
Make a copy of png images with "Apple Preview App" and uncheck Alpha.
Error message disappears.
I had this problem with one file from CocoaPods bundle. I've updated CocoaPods to the latest version and run:
after that, the problem has gone away.