Search code examples
cocoaquicklook

How to access QuickLook plugin resources?


My QuickLook plugin generates HMTL preview for the document. I need to display images saved in the plugin bundle. Simply using imageNamed: method to get an instance of the NSImage class doesn't work. How can achieve that? Is that a consequence of the fact that

Quick Look generators are designed as CFPlugIn-style bundles.

as the documentation says?


Solution

  • Within the plug-in code, you can access your plug-in CFBundle:

    QLThumbnailRequestGetGeneratorBundle or QLPreviewRequestGetGeneratorBundle

    Once you have the bundle, you can query for resources file URLs using:

    CFBundleCopyResourceURL