【发布时间】:2015-03-01 15:46:31
【问题描述】:
我做了一个可可应用程序,文件保存正常,当我双击一个时它会自动打开我的应用程序。我只需要弄清楚如何设置文件图标。
我为文件创建了一个 .icns 图标。这是我得到的
如您所见,文档在桌面上是“空白”,但 Finder 不知何故知道它的图标。
这是我的Info.plist
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>FileIcon.icns</string>
<key>CFBundleTypeName</key>
<string>My Type</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>xxx</string>
</array>
<key>NSDocumentClass</key>
<string>Document</string>
</dict>
</array>
我试过了:
- 上面的代码
- 上面的代码没有.icns
- 将新的 OSX 图标添加到 Images.xcasset 以及我用来创建 .icns 的文件
所有的结果都是一样的。有什么想法吗?
【问题讨论】: