簡體   English   中英

Spotlight 搜索不適用於 mac 催化劑應用程序

[英]Spotlight search not working for mac catalyst apps

我有一個 iOS 應用程序,它具有聚光燈搜索功能,允許用戶從應用程序中搜索項目。 它在 iOS 應用程序上運行良好在此處輸入圖像描述

我正在將應用程序遷移為催化劑應用程序,不知何故,mac 催化劑應用程序上的聚光燈搜索不起作用

在此處輸入圖像描述

到目前為止,已經檢查了以下內容

  • Spotlight 搜索邏輯按預期工作,沒有錯誤
  • 重新啟動的 Mac
  • 多次打開催化劑應用程序只是為了檢查它是否與核心聚光燈同步。
  • 沒有在 stack-overflow 上注冊以前的問題

環境: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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM