I'm writing a QuickLook extension for my app, and I want to be able to display the actual icon image for a particular file, as shown in Finder. I've tried using QLThumbnailGenerator for this, but it will always return a plain white document icon.

```
QLThumbnailGenerationRequest *request = [[QLThumbnailGenerationRequest alloc] initWithFileAtURL:url size:size scale:scale representationTypes:QLThumbnailGenerationRequestRepresentationTypeIcon];

QLThumbnailGenerator *generator = [QLThumbnailGenerator sharedGenerator];

__unsafe_unretained PreviewViewController *weakSelf = self;

[generator generateBestRepresentationForRequest:request completionHandler:^(QLThumbnailRepresentation *thumbnail, NSError *error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (thumbnail == nil || error) {
            NSLog(@"Failed to generate thumbnail! %@", error);
            // Handle the error case gracefully
        } else {
            // Display the thumbnail that you created
            NSLog(@"Generated thumbnail!");
            weakSelf.imageView.image = thumbnail.NSImage;
        }
    });
}];

```

Original code [here](https://github.com/angstsmurf/spatterlight/blob/quicklook/SpatterlightQuickLook/PreviewViewController.m#L329-L362).