【问题标题】:IOS9: CoreSpotlight and SiriIOS9:CoreSpotlight 和 Siri
【发布时间】:2015-10-20 04:44:58
【问题描述】:

在我的 IOS9 应用程序中,我可以使用 CoreSpotlight 库将数据添加到 Spotlight 的索引中(即,当我使用 Spotlight 搜索框进行搜索时,我添加到索引中的内容会显示出来)。

但是,Siri 似乎并没有从那里提取信息。这是我的代码:

let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeText as String)
attributeSet.title = "AWS Traffic"
attributeSet.contentDescription = "AWS Server Traffic in MyCompany"
attributeSet.keywords = ["MyApp", "AWS", "Server", "Traffic"]

let item = CSSearchableItem(uniqueIdentifier: "com.mycompany.MyApp", domainIdentifier: "com.company.MyApp.AWS", attributeSet: attributeSet)

CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { (error: NSError?) -> Void in
    if let error = error {
        print("Indexing error: \(error.localizedDescription)")
    } else {
        print("Search item successfully indexed!")
    } 
}

有什么方法可以让 Siri 显示我的应用程序中的索引数据?目前,当我使用关键字与 Siri 对话时,它只会进行网络搜索。

【问题讨论】:

  • 我也有同样的经历。你解决了吗?

标签: ios siri corespotlight


【解决方案1】:

目前,在 iOS 9 中,Siri 不会与您的应用添加到 Spotlight 索引中的项目进行交互。此 API 仅用于让项目出现在 Spotlight 搜索结果中,而不是在 Siri 响应中。

【讨论】:

    猜你喜欢
    • 2015-11-15
    • 2015-10-27
    • 1970-01-01
    • 2017-01-19
    • 2015-10-13
    • 2015-12-27
    • 1970-01-01
    • 2016-01-03
    • 2018-03-27
    相关资源
    最近更新 更多