【问题标题】:Can I programmatically tell if Spotlight is enabled?我可以以编程方式判断 Spotlight 是否已启用?
【发布时间】:2014-07-04 08:37:29
【问题描述】:

我在我的应用程序中使用 Spotlight API (NSSMetadataQuery)。如果用户尝试对未编入索引的卷执行 Spotlight 查询,我想向他们显示有用的注释。

我可以通过运行“mdutil -s /Volumes/Foo”在终端中确定这一点。

是否有无需运行外部程序即可返回此信息的 API?

【问题讨论】:

    标签: macos cocoa spotlight


    【解决方案1】:

    似乎既没有记录在案的方法或书面解决方案。 The same question has been asked before to no avail on Apple's Mailing List,所以我猜using NSTask and parsing the output(我的粗略示例代码链接)将是从 Cocoa 应用程序/以编程方式获取此信息的一种方法。

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-13
      相关资源
      最近更新 更多