How do I create a daemon

Asked on 08/01/2024

1 search

To create a daemon on macOS, you can follow the steps outlined in the "Support semantic search with Core Spotlight" session from WWDC 2024. Here’s a summary of the process:

  1. Create a New Target:

    • Navigate to the file menu and select "New Target".
    • Select the platform for the extension (e.g., macOS).
    • Search for the new Core Spotlight delegate extension template.
    • Click "Next" to configure this new target and "Finish" to add it to your project.
  2. Activate the New Extension:

    • Once added, activate the new extension.
    • You can now look at the stub implementation.
  3. Debugging:

    • Set a breakpoint in the reindexAll method to catch this point in the code.
    • Make sure to call the acknowledgment handler to avoid blocking the caller.
    • Rebuild your app to include this new app extension.
    • Select the app's target, then head to the product menu and select "Build".
    • Switch back to your extension target and from the debug menu, select "Attach to Process".
  4. Using Command Line Utility for Debugging:

    • Use the mdutil tool to simulate requests to your bundle ID for debugging.
    • Run the utility command in the terminal and then check your project in Xcode to see if you hit the breakpoint.

For more detailed steps, you can refer to the session Support semantic search with Core Spotlight (05:13).

Relevant Sessions

If you need more specific details or have other questions, feel free to ask!