Search code examples
xcodemacosxcode4.6quicklook

Debugging Quicklook Plugin in Xcode


I am trying to debug a quicklook plugin in Xcode 4.6. I have created the executable in Edit Scheme.

Now, when I build the project the plugin is not installed to the "/Library/Quicklook" path. Rather I didn't find it anywhere.

I want to run the plugin in debug mode and want to hit the breakpoints so that I can figure out where the plugin crashes on different files.


Solution

  • You can use brake points and NSLog function for debugging QL plugin. But first you need to configure environment.

    • Select your project on Project Navigator
    • Then select QL plugin target
    • Go to 'Build Phases' tab and add new phase 'Copy files'
    • Select 'Absolute Path' on destination drop down menu and set ~/Library/QuickLook as subpath
    • Open terminal and copy qlmanage to your project's root directory with command cp /usr/bin/qlmanage PROJECT_ROOT_DIR
    • Then select menu Product -> Scheme -> Edit Scheme...
    • Select 'Run' on schemes list
    • On info tab select executable drop down menu, then 'Other...' and select qlmanage binary you have copied to project's root directory
    • On arguments tab add row for 'Arguments Passed On Launch' and set value to -p FULL_PATH_TO_FILE_FOR_PREVIEW

    After all steps you can run your project and debug your code.