gpt4 book ai didi

IOS9 : CoreSpotlight and Siri

转载 作者:可可西里 更新时间:2023-11-01 05:51:31 24 4
gpt4 key购买 nike

在我的 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 9 中,Siri 不会与您的应用程序添加到 Spotlight 索引的项目进行交互。此 API 仅用于使项目显示在 Spotlight 搜索结果中,而不是在 Siri 响应中。

关于IOS9 : CoreSpotlight and Siri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33228194/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com