Unknown Error when adding an CSSearchableItem to Core Spotlight (MacOS)

谁说胖子不能爱 提交于 2019-12-04 09:36:36

With macOS 10.13, SIP and the App Sandbox seem to have become a little more strict. After a lot of digging to get this work, here's what I did, and should work for others reading this too:

  1. In Xcode, toggle the "App Sandbox" capability for your target in which your CoreSpotlight code runs. If this is in a framework, it needs to be the hosting application's target. This shouldn't be necessary for new projects (for details, see this bug report).
  2. Enable development signing for the application/binary which will run the CoreSpotlight code. In my case, it was the test host.

Eventually I managed to resolve the problem somehow, I followed the hint that the code was working in a playground. So I did what I wanted to do anyway and put the code in a framework. Without any further changes, it started to work. So apparently it had to do with the project configuration but it would be great if somebody came up with an idea what's the underlying reason for Spotlight to fail.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!