简体   繁体   English

IOS9:CoreSpotlight和Siri

[英]IOS9: CoreSpotlight and Siri

In my IOS9 app, I am able to add data to spotlight's index using CoreSpotlight library (ie what I add to the index shows up when I search using the spotlight search box). 在我的IOS9应用程序中,我可以使用CoreSpotlight库将数据添加到聚光灯的索引(即当我使用聚光灯搜索框搜索时,我添加到索引的内容会显示)。

However, Siri doesn't seem to be pulling info from there. 然而,Siri似乎并没有从那里获取信息。 Here is my code: 这是我的代码:

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!")
    } 
}

Is there any way of getting Siri to show the indexed data from my app? 有没有办法让Siri显示我的应用程序的索引数据? Currently, when I speak to Siri with my keywords, it just does a web search. 目前,当我使用我的关键字与Siri交谈时,它只是进行网络搜索。

At this time, in iOS 9, Siri does not interact with the items your app adds to the Spotlight index. 目前,在iOS 9中,Siri不会与您的应用添加到Spotlight索引的项目进行互动。 This API is only used to get items to appear in Spotlight Search results, not in Siri responses. 此API仅用于将项目显示在Spotlight搜索结果中,而不是用于Siri响应中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM