Icon image files

Once I've added my imported PNG icon files to the xcassets panel, is it OK to delete them from the project? After doing so, I notice that the images still appear in the assets panel, and I still get the right icon when I run the app. I also no longer get this errror:


resource fork, Finder information, or similar detritus not allowed

Command CodeSign failed with a nonzero exit code


This is a macOS app, if that makes any difference.

Accepted Reply

This detritus problem is really annoying (I stumbled on it a lot of times).


Once you have copied in xcAssts, You can remove from teh resources (take care, keep a copy of the file before, because deleting from XCode may delete the original file itself).


To solve detritus issue, you have to use Terminal and use xattr command:


Technical Q&A QA1940 advises the following:

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>
replacing <path_to_app_bundle> with the path to your actual app bundle.
You can also remove all extended attributes from your app bundle with the xattr command:
$ xattr -cr <path_to_app_bundle>

Replies

This detritus problem is really annoying (I stumbled on it a lot of times).


Once you have copied in xcAssts, You can remove from teh resources (take care, keep a copy of the file before, because deleting from XCode may delete the original file itself).


To solve detritus issue, you have to use Terminal and use xattr command:


Technical Q&A QA1940 advises the following:

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>
replacing <path_to_app_bundle> with the path to your actual app bundle.
You can also remove all extended attributes from your app bundle with the xattr command:
$ xattr -cr <path_to_app_bundle>

>I also no longer get this errror


Appears you've found an otherwise decent workaround for the bug (?)/remedies mentioned in QA1940. In your case, if you no longer need those individual images, say for building a help file/in app tutorial for that project/application, other targets, etc. then no harm, no foul. Good job.

I hadn't seen this problem until I used the macOS Preview app to change the dimensions of a couple of the icon files. Previously I'd saved all the icons from where I'd designed them: i.e. Affinity Designer. Perhaps Preview added something Xcode didn't like when I exported the edited image files.


I was using Preview to save time. Such irony.