How do I debug a quick look preview extension?

Generated on 7/30/2024

1 search

To debug a Quick Look preview extension, you can follow these steps:

  1. Set Up Your Extension: First, create a new target for your Quick Look preview extension. Navigate to the file menu, select "New Target," choose the platform (e.g., macOS), and select the appropriate extension template.

  2. Activate and Build: Once the new target is added, activate the extension. Then, select the app's target, go to the product menu, and select "Build" to include the new extension in your app.

  3. Attach to Process: Switch back to your extension target. From the debug menu, select "Attach to Process."

  4. Use Command Line Utility: Use the mdutil tool to simulate requests to your bundle ID for debugging. This allows you to run the utility command and then return to Xcode to see if you hit the breakpoint.

  5. Set Breakpoints: Set breakpoints in your code where you want to debug. For example, you might set a breakpoint in the reindexAll method to catch this point in the code.

  6. Inspect Variables: Use the variable viewer or hover over variables in the source code to inspect them. Some types even have a Quick Look button providing additional details for the variable.

For more detailed guidance on debugging techniques, you can refer to the session Run, Break, Inspect: Explore effective debugging in LLDB (21:05).

Relevant Sessions

  1. Run, Break, Inspect: Explore effective debugging in LLDB
  2. Support semantic search with Core Spotlight
  3. What’s new in Quick Look for visionOS