Bundle icon doesn't appear
|
|
Thread rating:  |
Keith Wiley - 03 Mar 2006 07:50 GMT I have been having this problem off and on for as long as Mac OS X has been around. I have a Carbon Bundle nib project. I build it and get a bundle that runs just fine. However, sometimes, not in all cases, the bundle does not have the icon I defined in an .icns file and added to the project in the Package tab under Resources. The Info.plist is correct, I am quite sure. Sometimes, my app gets an icon (and then it sticks for a while), but occasionally I rebuild from scratch and the icon is gone again. I have tried logging out and logging back in, but this has no effect.
A similar problem, my Info.plist defines a document file type with a file extension and an icon for the document files. Likewise, I practically never see my file type icon my document files.
I have 10.4.5 and CW 10, IDE 5.5.5 at the moment, but like I said, this problem has persisted through many versions of OS X for many years.
I think there are some pref files that can be deleted which *might* solve this problem, but I don't know what they are.
Does anyone know the solution to this problem? Why is it so persistent? Am I doing something dreadfully wrong in the way I construct my project. It's postively, and as it has done on forever, I'm getting pretty sick of it.
Thanks.
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
larry@skytag.com - 03 Mar 2006 21:33 GMT I really can't say why the problem is ocurring since I set my project up differently. I don't use any of CW's package features. I created a master bundle and the only thing CW knows about is the MacOS folder in which it creates the executable binary and I've never had a single problem. It has some other advantages such as allowing me to tweak nibs and see the results without having to quit my application or do anything in CW, and every build is a clean build for me. ;-)
As for solving your problem, have you tried the standard trick of Option-dragging your application to another folder to get the Finder to tell Launch Services to update its database? You'll probably need to restart the Finder afterwards to avoid Finder caching issues.
Larry
Keith Wiley - 03 Mar 2006 23:16 GMT > As for solving your problem, have you tried the standard trick of > Option-dragging your application to another folder to get the Finder to > tell Launch Services to update its database? You'll probably need to > restart the Finder afterwards to avoid Finder caching issues. Not exactly what you're suggesting, but functionally identical, I have discovered that "duplicating" the bundle does the trick.
However, recall that I am also not seeing my document icons. I can paste the document icons into the documents' Info windows, but that's an absurd thing to have to do.
Thanks.
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Ben Artin - 04 Mar 2006 00:20 GMT > > As for solving your problem, have you tried the standard trick of > > Option-dragging your application to another folder to get the Finder to [quoted text clipped - 3 lines] > Not exactly what you're suggesting, but functionally identical, I have > discovered that "duplicating" the bundle does the trick. If duplicating the bundle fixes the icon, then that means that the Finder's cache was stale for the original, and that if you logged out and back in (which I believe is guaranteed to clear Finder's icon cache), the icon would be correct. This is not something that will affect your customers.
> However, recall that I am also not seeing my document icons. I can paste > the document icons into the documents' Info windows, but that's an absurd > thing to have to do. You should try duplicating the app *and* duplicating the documents. If that fixes the document icons, then the answer is the same as above. If not, there might be something wrong with your plist.
Ben
 Signature If this message helped you, consider buying an item from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Keith Wiley - 04 Mar 2006 17:58 GMT > If duplicating the bundle fixes the icon, then that means that the Finder's > cache was stale for the original, and that if you logged out and back in (which > I believe is guaranteed to clear Finder's icon cache), the icon would be > correct. This is not something that will affect your customers. No, I have tried that many times. Logging and and in, shutting down and rebooting, never fix the app icons. Only duplicating the bundle fixes the icon.
> You should try duplicating the app *and* duplicating the documents. If that Duplicating the documents does not fix the document icons although duplicating the bundle does fix the bundle/app's icon.
The following is my plist. Does anyone see anything obviously wrong with it? I have verified that my document files have the extension ".dru" and that they has the OSType 'drui'. They also have the creator type 'Drui'. This is all correct and matches the plist...I think.
Thanks.
<plist version="1.0"> <dict> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleIdentifier</key> <string>Druid</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleName</key> <string>Druid</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>Drui</string> <key>NSAppleScriptEnabled</key> <string>True</string> <key>LSPrefersCarbon</key> <string>True</string> <key>CFBundleIconFile</key> <string>appIcon</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeOSTypes</key> <array> <string>drui</string> </array> <key>CFBundleTypeIconFile</key> <string>fileIcon</string> <key>CFBundleTypeName</key> <string>Druid document</string> <key>CFBundleTypeExtensions</key> <array> <string>dru</string> <string>drui</string> </array> <key>CFBundleTypeRole</key> <string>Editor</string> </dict> </array> </dict> </plist>
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Ben Artin - 04 Mar 2006 21:35 GMT > > If duplicating the bundle fixes the icon, then that means that the Finder's > > cache was stale for the original, and that if you logged out and back in [quoted text clipped - 5 lines] > rebooting, never fix the app icons. Only duplicating the bundle fixes the > icon. OK, in that case it's probably not the Finder, but Launch Services that has the stale icon. I am going to fast-forward over a rant about Launch Services here because it would take hours.
In short, my theory is that your Launch Services database is hosed and you need to rebuild it. We had to deal with this kind of a problem during development of Fetch 5, and we ended up with this AppleScript:
*** Warning: This script is very much *not* undoable. It empties your trash and completely blows away your Launch Services database. Resetting the LS DB will reset your "Open all files like this with" settings (but not your "Open this file with" settings).
tell application "Finder" empty trash end tell do shell script "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/L aunchServices.framework/Versions/A/Support/lsregister -kill -r -domain system -domain local -domain user -domain network"
For your purpose, you'll probably want to delete all old versions of your application before running the script and log out or restart afterwards (the latter to make sure Finder gets with the program). Then you will need to build a fresh copy of your app and launch it, so that it gets readded to LS DB. Finally, after you are done with all this, the Finder may still be confused if your app or your app's documents were in an open window before you launched the fresh copy of your app, so you may need to relaunch the Finder (or log out, or restart).
I hope this helps, and I am sorry this is so hand-wavy; I am not a fan of Launch Services either.
Off-hand, I see nothing wrong with your plist.
Ben
 Signature If this message helped you, consider buying an item from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Chris Baum - 05 Mar 2006 01:56 GMT > *** Warning: This script is very much *not* undoable. It empties your trash > and [quoted text clipped - 11 lines] > aunchServices.framework/Versions/A/Support/lsregister -kill -r -domain system > -domain local -domain user -domain network" Thanks for that script.
I don't know of any complete documentation so it's voodoo to me, but as of 10.4, I noticed that if I set the project's output folder (in CW) to a location within the Applications folder, Finder/Launch Services seems to always notice my app/plist changes when I build. Then again, this could be in the same category as my 'lucky White Sox hat'.
Keith Wiley - 05 Mar 2006 15:42 GMT Thanks. I'll take with all the warnings it deserves.
>>> If duplicating the bundle fixes the icon, then that means that the Finder's >>> cache was stale for the original, and that if you logged out and back in [quoted text clipped - 42 lines] > > Ben ________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Keith Wiley - 05 Mar 2006 17:27 GMT > "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/L > aunchServices.framework/Versions/A/Support/lsregister -kill -r -domain system > -domain local -domain user -domain network" After reading your post, I found a lot of info on the web about this command and gave it a shot. I then logged out and logged in again. To my disbelief, this did not solve the problem. All of the document files for my application still have blank standard document icons, except the ones that I manually pasted the document icon into. I thought maybe it doesn't change existing document icons but will make things work from now on though, so I ran my program, created a new document and saved. No dice. The new file still has a blank document icon. There really doesn't seem to be anything wrong with my plist. I posted it in a previous post and no one saw any errors in it.
What the heck is going on?! Why is this so infuriating? Am I just making unreasonable requests on the Mac OS when I want it to put a stylized icon on my app's document files?
If anyone has any other ideas, I'd love to hear them. I thought there were some launch service pref files I could delete, but I'm not sure which ones they are, and I am weary of deleting files without knowing for sure because I may make my system unbootable or something.
Thanks.
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Eric Albert - 05 Mar 2006 20:39 GMT > > "/System/Library/Frameworks/ApplicationServices.framework/Versions/A > > /Framewo rks/L [quoted text clipped - 15 lines] > unreasonable requests on the Mac OS when I want it to put a stylized icon > on my app's document files? What you've described says that something's wrong with your plist. I didn't see it posted, but maybe I missed it. Can you post it again?
-Eric
 Signature Eric Albert ejalbert@cs.stanford.edu http://outofcheese.org/
Keith Wiley - 06 Mar 2006 00:14 GMT > What you've described says that something's wrong with your plist. I > didn't see it posted, but maybe I missed it. Can you post it again? I would appreciate any thoughts you have. Here it is. Thanks.
<plist version="1.0"> <dict> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleIdentifier</key> <string>Druid</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleName</key> <string>Druid</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>Drui</string> <key>NSAppleScriptEnabled</key> <string>True</string> <key>LSPrefersCarbon</key> <string>True</string> <key>CFBundleIconFile</key> <string>appIcon</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeOSTypes</key> <array> <string>drui</string> </array> <key>CFBundleTypeIconFile</key> <string>fileIcon</string> <key>CFBundleTypeName</key> <string>Druid document</string> <key>CFBundleTypeExtensions</key> <array> <string>dru</string> <string>drui</string> </array> <key>CFBundleTypeRole</key> <string>Editor</string> </dict> </array> </dict> </plist>
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Ben Artin - 06 Mar 2006 01:38 GMT > <key>CFBundleTypeIconFile</key> > <string>fileIcon</string> Make 100% sure that there is a "fileIcon.icns" inside your bundle's Resources folder (and make sure that it's really fileIcon.icns, rather than (for example) "fileIcon" or "fileIcon.icns.icns".
Ben
 Signature If this message helped you, consider buying an item from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Keith Wiley - 07 Mar 2006 19:36 GMT >> <key>CFBundleTypeIconFile</key> >> <string>fileIcon</string> > > Make 100% sure that there is a "fileIcon.icns" inside your bundle's Resources > folder (and make sure that it's really fileIcon.icns, rather than (for example) > "fileIcon" or "fileIcon.icns.icns". It is. Any other ideas?
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Ben Artin - 08 Mar 2006 06:08 GMT > > Make 100% sure that there is a "fileIcon.icns" inside your bundle's > > Resources folder (and make sure that it's really fileIcon.icns, rather than > > (for example) "fileIcon" or "fileIcon.icns.icns". > > It is. Any other ideas? Run this in Terminal:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchService s.framework/Support/lsregister -dump
and show us the sections of the output that pertain to your app (you can find them by searching for your app's bundle ID in the output).
Ben
 Signature If this message helped you, consider buying an item from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Keith Wiley - 09 Mar 2006 05:04 GMT I got it to work, although I don't understand what the original problem was. The fileIcon.icns file was "wrong" somehow. It did have the right name and the right extension. You never know how the Finder is going to do weird things to the appearance of a file name, but Terminal never lies and the name was definitely correct, extension and all...and the file wasn't corrupted because I could open it in Iconographer and view it just fine.
Anyway, I opened the file, did Save As (not Save) chose a different name, closed the file, trashed the original, and renamed the new file to the original file name. Ba dum ching. It worked immediately (after rebuilding the package, logging and logging back in again). I have no idea what happened. Oh well.
Thanks for all the suggestions.
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Koen De Poorter - 09 Mar 2006 10:11 GMT On 09-03-2006 05:04, in article Pine.LNX.4.62.0603082159590.14236@brown.cs.unm.edu, "Keith Wiley" <kwiley@cs.unm.edu> wrote:
> I got it to work, although I don't understand what the original problem > was. The fileIcon.icns file was "wrong" somehow. It did have the right [quoted text clipped - 9 lines] > rebuilding the package, logging and logging back in again). I have no > idea what happened. Oh well. I had some weird experiences with Iconographer as well. Aren't there 2 formats for the .icns icon bundles? Sometimes you see the icon in the finder and sometimes you see just the iconographer document icon. I still have to figure that out.
Koen
James W. Walker - 06 Mar 2006 07:04 GMT > I would appreciate any thoughts you have. Here it is. Thanks. > > <plist version="1.0"> (snip)
Neither of these things should have anything to do with your icon, but:
1. You did not specify CFBundleExecutable. 2. The value for LSPrefersCarbon should be either <string>YES</string> or <true/>.
Eric Albert - 07 Mar 2006 04:10 GMT > > I would appreciate any thoughts you have. Here it is. Thanks. > > [quoted text clipped - 4 lines] > > 1. You did not specify CFBundleExecutable. This is important for a bunch of tools. I'd strongly suggest adding that key and its corresponding value right away.
> 2. The value for LSPrefersCarbon should be either <string>YES</string> > or <true/>. Ditto for NSAppleScriptEnabled. I think <true/> is preferred, by the way.
-Eric
 Signature Eric Albert ejalbert@cs.stanford.edu http://outofcheese.org/
Keith Wiley - 07 Mar 2006 19:44 GMT > 1. You did not specify CFBundleExecutable. What should the value be? The name of the bundle?
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
Eric Albert - 08 Mar 2006 04:56 GMT > > 1. You did not specify CFBundleExecutable. > > What should the value be? The name of the bundle? The name of the executable. "Druid", if I'm remembering correctly from your other post.
-Eric
 Signature Eric Albert ejalbert@cs.stanford.edu http://outofcheese.org/
larry@skytag.com - 11 Mar 2006 22:54 GMT > What should the value be? The name of the bundle? No. The reason it's named "CFBundleExecutable" is that it's the name of the bundle's executable.
One of the reasons you need this is that without it, the system looks for an executable whose name matches that of the bundle. As a result, if the user changes the name of the bundle, it won't launch anymore.
Larry
larry@skytag.com - 07 Mar 2006 02:08 GMT > > As for solving your problem, have you tried the standard trick of > > Option-dragging your application to another folder to get the Finder to [quoted text clipped - 3 lines] > Not exactly what you're suggesting, but functionally identical, I have > discovered that "duplicating" the bundle does the trick. Based on comments from an Apple engineer, my understanding is that these are not functionally equivalent with regard to updating the LS database, which is why I suggesting Option-dragging instead of duplicating. Option-dragging causes the LS database to be updated, but duplicating does not. However, if rebuilding the LS database didn't help, then this is probably not going to help.
> However, recall that I am also not seeing my document icons. I can paste > the document icons into the documents' Info windows, but that's an absurd > thing to have to do. Of course it is, and it isn't relevant to this discussion. Based on your other posts I'd guess that either you don't have a fileIcon.icns file in your Resources folder, or you're experiencing some problem related to having multiple copies of your application on your disk, such as an old version with bad or missing icon info for your file type.
Larry
Keith Wiley - 07 Mar 2006 19:33 GMT > your other posts I'd guess that either you don't have a fileIcon.icns > file in your Resources folder, or you're experiencing some problem > related to having multiple copies of your application on your disk, > such as an old version with bad or missing icon info for your file > type. I appreciate the tips, but neither is helping. Sorry. I do indeed have a "fileIcon.icns" fil in the Resources folder of the package. Observe:
[keithg5:Druid/vDev/Druid.app] keithwil% ls -R total 0 0 Contents/
./Contents: total 24 16 Info.plist 8 PkgInfo 0 MacOSClassic/ 0 Resources/
./Contents/MacOSClassic: total 9088 3040 Druid 6048 Druid.xSYM
./Contents/Resources: total 240 16 Info.plist 120 fileIcon.icns 104 appIcon.icns 0 main.nib/
./Contents/Resources/main.nib: total 120 8 classes.nib 8 info.nib 104 objects.xib [keithg5:Druid/vDev/Druid.app] keithwil%
It opens just fine into Iconographer. I have also made sure that are no duplicate copies of the bundle on my entire harddrive. I even emptied the trash after throughing duplicates away.
________________________________________________________________________ Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________
|
|
|