简体   繁体   中英

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).

However, Siri doesn't seem to be pulling info from there. 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? Currently, when I speak to Siri with my keywords, it just does a web search.

At this time, in iOS 9, Siri does not interact with the items your app adds to the Spotlight index. This API is only used to get items to appear in Spotlight Search results, not in Siri responses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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