【发布时间】:2023-01-25 20:11:48
【问题描述】:
我已成功创建 UTI,并且 Finder 能够识别文件属于我的应用程序并且它们是特定类型(例如 ITC 数据文件)。但是,我无法让操作系统使用我在 Xcode 的属性列表文件中指定的自定义图标。
这是我的 plist 文件的相关部分:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>itc</string>
<string>vpitc</string>
<string>ITC</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>DataFileBackground</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>0</integer>
<key>CFBundleTypeName</key>
<string>ITC Data File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.itcdatafile</string>
</array>
<key>NSDocumentClass</key>
<string></string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ftitc</string>
<string>FTITC</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ProjectFileIcon</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>0</integer>
<key>CFBundleTypeName</key>
<string>FT-ITC Project File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.ftitcproject</string>
</array>
<key>NSDocumentClass</key>
<string></string>
</dict>
</array>
我以前设法让 Finder 显示自定义测试图标,但我不确定我是怎么做到的,也无法重现它。这些图标在“资产”中定义为“macOS 通用图标”:
如何获得关联文件的自定义图标?更改(如果成功)是否需要时间来更新操作系统?
谢谢。
【问题讨论】: