我正在尝试将我的应用程序使用的文件类型(扩展名 .sbd
)与我的应用程序相关联,并让保存的文件显示自定义文档图标。我已经在 Xcode 中设置了 Document Types 部分,如下所示:
这是我的 Info.plist
文档类型部分:
我在这里看过其他类似的问题,但他们要么提到 CFBundleTypeIconFile
,这似乎已被弃用,或者它们无法解决问题。有什么我没有做或做错的事情吗?
最佳答案
尝试设置 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>
清理并重建您的项目。如果图标没有更新,请尝试重新启动计算机。
关于xcode - 在 Xcode 中设置文档文件图标不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36683965/