在Xcode中设置文档文件图标不起作用?

时间:2016-04-18 01:05:59

标签: xcode macos icons document

我尝试将我的应用使用的文件类型(扩展名.sbd)与我的应用相关联,并让保存的文件显示自定义文档图标。我在Xcode中设置了文档类型部分,如下所示: Xcode Doc types settings

以下是文档类型的Info.plist部分:

info.plist

我已经在这里查看了其他类似的问题,但他们要么提到CFBundleTypeIconFile,这似乎已被弃用,要么他们无法解决问题。我有没有做过或做错了什么?

1 个答案:

答案 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;重建你的项目。如果图标未更新,请尝试重新启动计算机。