On 12 nov. 2012, at 01:22, Jerry Krinock wrote:
Probably you're filling out the correctly, but there may be more to do.
On thing I didn't do is to wait a few minutes after moving the app in the Applications folder so that launch service can update its database. I was constantly changing parameters, rebuilding, trying, etc.
• First, inspect the Info.plist file in your products's 'Contents' and make sure that the values in CFBundleDocumentTypes and UTExportedTypeDeclarations reflect your latest changes. (The keys I give here are the actual keys you'll see in a text editor, or in Plist Edit Pro with Definitions set to "None". I like to look at plist's "bare metal".)
I checked. They do.
• If you have built and run your app with the *wrong* information in Info.plist, your launch services database may be confused This happened to me a couple days ago. (Of course, if this is the problem your app will work OK on another Mac account.)
Well, now, it does work (almost) OK on an other account.
Things that work:
- The app is the default editor.
- The description string for the file type correctly displays in the finder
Things that don't work:
- The icon displayed for the file type is generic and does not match the one I specified.
- Quicklook doesn't generate a preview for my file.
Anyhow, make sure all builds of your app with bogus Info.plist have been deleted. Search the 'LSHandlers' in ~/Library/Preferences/com.apple.LaunchServices.plist for any entries referencing your app's document extension *or* bundle identifier. Look for duplicate, conflicting entries in particular. If you find anything wrong, fix it. Carefully, of course because your Mac needs this file to work properly. Then re-load it by running this command:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
Thanks for the tip. This is really useful.Here is my plist (ext stands for the file extension. DESCRIPTION is the string describing the file type):
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ext</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>file_icon</string>
<key>CFBundleTypeName</key>
<string>DESCRIPTION</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>app.identifier.ext</string>
</array>
<key>LSTypeIsPackage</key>
<false/>
<key>NSExportableAs</key>
<array/>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>DESCRIPTION</string>
<key>UTTypeIconFile</key>
<string>file_icon</string>
<key>UTTypeIconName</key>
<string>file_icon</string>
<key>UTTypeIdentifier</key>
<string>app.identifier.ext</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>ext</string>
</array>
</dict>
</dict>
</array>