4
votes

I have implemented a Quick Look generator that can display multiple image types, including JPEG files.

It is being called by the system to render thumbnails and previews for any of the file types that appear in its property list except for one: public.jpeg.

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string></string>
        <key>CFBundleTypeRole</key>
        <string>QLGenerator</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.jpeg</string>
            <string>com.canon.cr2-raw-image</string>
            <string>com.sony.arw-raw-image</string>
        </array>
    </dict>
</array>

Given the property list fragment above, my generator would be called successfully for .CR2 and .ARW files, but never for .JPG files.

I have reset the Quick Look generator database with qlmanage and confirmed using qlmanage -m that my generator is associated with the public.jpeg UTI (just as it is with the other two UTIs in this example).

qlmanage -m | grep jpeg
public.jpeg -> /Applications/MyApp.app/Contents/Library/QuickLook/MyQLGenerator.qlgenerator (123)

Nonetheless, when I select a JPEG file in Finder and press spacebar, Quick Look always invokes the default generator:

10/26/15 6:23:49.343 PM com.apple.quicklook.satellite[21978]: [QL] <QLThumbnailRequest testfile.jpg>. Content type UTI: public.jpeg. Generator used: <QLGenerator /System/Library/QuickLook/Image.qlgenerator>

Quick Look even invokes the default generator when I ask it specifically to invoke mine instead:

qlmanage -p -c public.jpeg -g "/Applications/MyApp.app/Contents/Library/QuickLook/MyQLGenerator.qlgenerator" testfile.jpg 
Testing Quick Look preview with files:
    testfile.jpg
    - force using content type UTI: public.jpeg
    - force using generator at path:
    /Applications/MyApp.app/Contents/Library/QuickLook/MyQLGenerator.qlgenerator

2015-10-26 18:43:34.450 qlmanage[22054:507] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8c27, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2015-10-26 18:43:34.475 qlmanage[22054:507] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8d47, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2015-10-26 18:43:34.475 qlmanage[22054:507] Failed to allocate communication port for com.apple.CFPasteboardClient; this is likely due to sandbox restrictions    

(The bootstrap_register() errors seem ubiquitous with Quick Look and also appear when previewing other file types, but those work as expected.)

Is there a way to get Quick Look to invoke my generator for JPEG files?

1

1 Answers

3
votes

This appears to be a bug in MacOS 10.9. The author of the qlImageSize project ran into the same problem and filed a radar report.

Another participant in this qlImageSize discussion thread remarked that "Apple responded to my bug report to confirm resolution in Yosemite. No mention of Mavericks."

My own experience is the same. The same Quick Look generator that is not called for public.jpeg under 10.9 works as expected under 10.10 and 10.11.