IOS9:CoreSpotlight和Siri

4
在我的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说话时,它只会进行网络搜索。


我也遇到了同样的问题。你解决了吗? - ED-209
1个回答

2

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接