gpt4 book ai didi

cocoa - 如何让 Spotlight 属性显示在获取信息窗口中?

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

我为漫画文件创建了一个聚光灯导入器。属性已成功导入并可搜索。剩下的一件事是让属性显示在文件的获取信息窗口中。

看起来这应该是编辑 schema.xml 文件的简单问题,因此属性嵌套在 displayattrs 标记内。不幸的是,这似乎不起作用。

我简化了测试插件。以下是所有重要文件。

架构.xml

<types>
<type name="cx.c3.cbz-archive">
<allattrs>
kMDItemTitle
kMDItemAuthors
</allattrs>
<displayattrs>
kMDItemTitle
kMDItemAuthors
</displayattrs>
</type>
<type name="cx.c3.cbr-archive">
<allattrs>
kMDItemTitle
kMDItemAuthors
</allattrs>
<displayattrs>
kMDItemTitle
kMDItemAuthors
</displayattrs>
</type>
</types>

GetMetadataForFile.m

Boolean GetMetadataForFile(void* thisInterface, 
CFMutableDictionaryRef attributes,
CFStringRef contentTypeUTI,
CFStringRef pathToFile)
{
NSAutoreleasePool * pool = [NSAutoreleasePool new];
NSString * file = (NSString *)pathToFile;
NSArray * authors = [[UKXattrMetadataStore stringForKey: @"com_opencomics_authors" atPath: file traverseLink: NO] componentsSeparatedByString: @","];
[(NSMutableDictionary *)attributes setObject: authors forKey: (id)kMDItemAuthors];
NSString * title = [UKXattrMetadataStore stringForKey: @"com_opencomics_title" atPath: file traverseLink: NO];
[(NSMutableDictionary *)attributes setObject: title forKey: (id)kMDItemTitle];
[pool release];
return true;
}

最佳答案

您似乎缺少 </types>标签。编写问题时复制/粘贴错误,或者 XML 文件中也缺少该问题吗?

如果文件中缺少它,则 XML 无效。

关于cocoa - 如何让 Spotlight 属性显示在获取信息窗口中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2841367/

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