gpt4 book ai didi

macos - 导出的 UTI 未被 macOS 拾取

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

我尝试在应用程序中导出 UTI,但 macOS (10.3.2) 未拾取它。我已经在一个较小的项目中复制了我的问题。这是 info.plist 的相关部分:

<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>Demo of custom file support</string>
<key>UTTypeIconFile</key>
<string>File-512</string>
<key>UTTypeIdentifier</key>
<string>am.customfiledemo.demotxt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>demotxt</string>
</array>
<array/>
</dict>
</dict>
</array>

我尝试重新启动,甚至重建启动服务数据库,但没有效果:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain ststem -domain user -v

当我检查文件的 UTI 时

mdls -name kMDItemContentType -name kMDItemContentTypeTree file.demotxt

我得到的是动态 (dyn.*) UTI,而不是 am.customfiledemo.demotxt

kMDItemContentType                 = "dyn.ah62d4rv4ge80k3prr74hu7a"
kMDItemContentTypeTree = (
"dyn.ah62d4rv4ge80k3prr74hu7a",
"public.data",
"public.item"
)

最佳答案

使 UTI 符合 public.datacom.apple.package:

Although a custom UTI can conform to any UTI, public.data or com.apple.package must be at the root of the conformance hierarchy for all custom UTIs that are file formats (such as documents); otherwise, the system can’t tell if an item on disk has that UTI.

-Uniform Type Identifiers Overview, Declaring New Uniform Type Identifiers, Recommendations for Declaring new Uniform Type Identifiers

关于macos - 导出的 UTI 未被 macOS 拾取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48534795/

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