[英]Spotlight search not working for mac catalyst apps
我有一個 iOS 應用程序,它具有聚光燈搜索功能,允許用戶從應用程序中搜索項目。 它在 iOS 應用程序上運行良好
我正在將應用程序遷移為催化劑應用程序,不知何故,mac 催化劑應用程序上的聚光燈搜索不起作用
到目前為止,已經檢查了以下內容
環境:macOS 12.0.1
PS:我不確定它是否與我的代碼相關,因為它在 iPad 和 iPhone 設備上運行良好。
let attributeSet = CSSearchableItemAttributeSet(contentType: .content)
attributeSet.title = decodeItem.name
attributeSet.relatedUniqueIdentifier = decodeItem.id
attributeSet.url = URL.init(string: decodeItem.url)
let searchableItem = CSSearchableItem(uniqueIdentifier: decodeItem.id,
domainIdentifier: "com.xxx.xxxx",
attributeSet: attributeSet)
searchableItems.append(searchableItem)
CSSearchableIndex.default().indexSearchableItems(searchableItems) { error in
if let error = error {
print("Issue indexing: \(error)")
} else {
print("Indexed.")
}
}
發現問題: 僅從初始化程序將值分配給attributeSet.relatedUniqueIdentifier
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.