我尝试将我的应用使用的文件类型(扩展名.sbd
)与我的应用相关联,并让保存的文件显示自定义文档图标。我在Xcode中设置了文档类型部分,如下所示:
以下是文档类型的Info.plist
部分:
我已经在这里查看了其他类似的问题,但他们要么提到CFBundleTypeIconFile
,这似乎已被弃用,要么他们无法解决问题。我有没有做过或做错了什么?
答案 0 :(得分:2)
尝试将CFBundleTypeRole
设置为Viewer
。您的Info.plist
必须如下所示:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>sbd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>SBDocumentIcon</string>
<key>CFBundleTypeName</key>
<string>icns</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
清洁&amp;重建你的项目。如果图标未更新,请尝试重新启动计算机。