前回のつづき:Core Spotlight にコンテンツをインデックスする
コンテンツのインデックスはできたので、WWDC24:Support semantic search with Core Spotlight に紹介されているセマンティック検索を試みようとした。これによると「セマンティック検索はプロセスに必要な学習モデルのダウンロードが必要」で、CSUserQuery.prepare() を事前に呼んでおく必要があるとのこと。
そのとおりにしたところ、以下のようなエラーが出力されてしまった。SpotlightResources 配下の Info.plist に権限がなくアクセスできないらしい。
Error loading asset properties: Error Domain=NSCocoaErrorDomain Code=257 "The file “Info.plist” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_SpotlightResources/xxx.asset/Info.plist, NSURL=file:///private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_SpotlightResources/xxx.asset/Info.plist, NSUnderlyingError=0x11b4419b0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
原因がわからない。
「Core Spotlight:セマンティック検索を試みる – その1」への1件のフィードバック