gpt4 book ai didi

cocoa - 放在 Dock 图标上

转载 作者:行者123 更新时间:2023-12-03 16:13:38 30 4
gpt4 key购买 nike

我正在浏览文档以查找如何允许放置在停靠栏图标上。据我所知,建议您使用 LSItemContentTypes,因为 CFBundleTypeOSTypes 已弃用。但是,我无法让 LSItemContentTypes 工作,只有 CFBundleTypeOSTypes 为 ** 时它才会接受掉落。

如何以不弃用的方式执行此操作?

谢谢,尼克

最佳答案

以下是我在应用程序的 Info.plist 中使用的使其正常工作的内容:

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>SomeName</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
<key>LSItemContentTypes</key>
<array>
<string>public.mp3</string>
</array>
</dict>
</array>

看看Documentation查看每个键的具体功能。

CFBundleTypeNameCFBundleTypeRole 是必需的。

LSItemContentTypesUTIs 的数组。要获取文件的 UTI,只需在终端中键入:

mdls -name kMDItemContentType /path/to/file

不要忘记调整 CFBundleTypeRoleLSHandlerRank 以满足您的需求。

关于cocoa - 放在 Dock 图标上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4637426/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com