r/macosprogramming • u/B8edbreth • Feb 06 '24
QuickLookThumbnailReply not working
I've attempted to create a quicklook thumbnail extension for my app. The problem is it doesn't work, never seems to be called, no break points are stopped at and nothing gets logged either to xcode's console or to the console app.
This is my code What am I doing wrong?
NSImage * image;
if([pe isEqualTo:@"dmp"]){
image = [self getIconFromSerialData:request.fileURL];
}
else if([pe isEqualTo:@"dmf"]){
image = [self getIconFromProject:request.fileURL];
}
NSRect rect = NSMakeRect(0, 0, request.maximumSize.width, request.maximumSize.height);
DMImageViewExtension * iv = [[DMImageViewExtension alloc]initWithFrame:rect];
handler([QLThumbnailReply replyWithContextSize:request.maximumSize drawingBlock:^BOOL(CGContextRef _Nonnull context) {
NSGraphicsContext * ctx = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO];
[iv drawIntoContext:ctx withRect:iv.bounds];
return YES;
}], nil);This is the property list for the extension:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>QLSupportedContentTypes</key>
<array>
<string>com.dm.serialized</string>
<string>com.dm.project</string>
</array>
<key>QLThumbnailMinimumDimension</key>
<integer>10</integer>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.quicklook.thumbnail</string>
<key>NSExtensionPrincipalClass</key>
<string>ThumbnailProvider</string>
</dict>Do I need to take out the icon file information from my app's info.plist file?
1
Upvotes
View all comments
Show parent comment
1
u/B8edbreth Feb 08 '24
Thank you. I finally got it giving me a thumbnail if I manually create a thumbnail request .
So does Apple allow me to place a copy of my plug in in the QuickLook plugins folder? Do I need a special entitlement to do this?