Setting the icons of resources associated with my application using a plist (cocoa osx)
My application creates some xml files that are proprietary to my application and I would like to associate these file types with my application, originally I set the icons of newly created files using setIcon:forFile:options: but it seems like I should be using a plist instead. In the documentation I found how to set the icon of the application itself but I could not find any description about how to开发者_如何学运维 set icons of other associated file types. Could anyone link me to such info?
These are more general and provide background info:
Information Property List Files
About Information Property List Files
These are specific to document types:
CFBundleDocumentTypes
Storing Document Types Information in the Application's Property List
Apple provides an overview on the topic here. For a breakdown of available keys see here.
As an example:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>typename</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>ext</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>icon.icns</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false />
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
精彩评论