【发布时间】: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