Problems changing an app's document icon

I am running on macOS 13.3.1 (a). I have a longstanding macOS app with a document icon. I have changed app's icon and document icon in the latest release. The new application icon shows correctly on the app's icon, but the new document icon does not display properly in the title bar of my NSDocument windows. All I did was to change the application and document icons in the Asset catalog and recompile with Xcode 14.3. My documents are file packages. There are no copies of the application with the old document icon anywhere on my disk. If I create a new document using the app, the document displays the correct--new--icon, but when the app opens the document, the icon that appears in the title bar is the old document icon. When I discovered this I rebuilt the launch services database, but the problem remains. From where could the system be getting that old icon? Does anybody have any idea how to fix this?

Replies

Did you do a Clean Build folder ? And possibly remove all derived data ?

Good thinking! I had done neither. I cleaned the build folder, recompiled--no change. I then deleted everything in the Build folder, emptied the Trash, recompiled--still no change.

In situations like this I recommend that you retest with a ‘clean’ machine, one that’s never seen your app before (I usually use a VM for this, restoring from a clean snapshot between each test). That’ll allow you to distinguish between these two cases:

  • Your app is built wrong.

  • The system has cached the old info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Another great suggestion. I had a new partition with 12.6.5 installed, so I opened the new app for the first time there. All was well. Correct app icon. Correct document icon on document created. Correct document icon in window title. That would suggest that the application was built correctly. I then erased the partition, realinstalled 12.6.5, and downloaded the old app with the old icon. I launched it and created a document. Correct (old) app icon. Correct (old) documnt icon. Correct (old) document icon in window title. I then closed app and replaced it in the applications folder with the new app. The old icon remained in the dock in the recently used section. I clicked on it, and it changed to the new icon. The document icon on the document did not change. I double-clicked it to open the document. It's icon remains the old icon. The icon in the title bar remains to old icon. Is this an OS bug or am I doing something wrong?

Is this an OS bug or am I doing something wrong?

That sounds like an old bug. macOS has a long history of problems like this, dating all the way back to traditional macOS [1]. I don’t know what the state of the art for this is on current versions of the system.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] https://www.macintoshrepository.org/articles/9-rebuilding-the-desktop