QuickLook Thumbnailing returns stale macOS 26 folder icon

On macOS 26, I've run into a situation when a user “customizes” a folder icon with Finder by assigning/changing an SF Symbol or an emoji, QLThumbnailGenerator keeps returning the stale initially retrieved folder icon (no matter whether it had been customized or not) until my app quits. After the app is re-launched, the icon is correctly retrieved once again.

let generator = QLThumbnailGenerator.shared
let size: CGSize = CGSize(width: 64, height: 64)
let request = QLThumbnailGenerator.Request(fileAt: url, size: size, scale: NSScreen.main!.backingScaleFactor, representationTypes: .icon)
request.iconMode = true
do {
    let thumb = try await generator.generateBestRepresentation(for: request)
    thumb.nsImage.size = size
    return thumb.nsImage
} catch {
    print("generateThumbnail: \(error)")
    return nil
}

It seems like the QuickLook Thumbnailing cache does not invalidate automatically upon folder customization. Is there any way to manually invalidate the QuickLook Thumbnailing cache?

Same issue here. It seems that each application has its own hidden location where cached icons are stored.

QLThumbnailGenerator is for generating thumbnails. It sounds like you are just trying to read whatever icon is there, not generate a new one.

Just use one of the NSWorkspace or URL methods to retrieve the icon.

Never use the comments feature. All it does is hide your reply.

I see what you mean. I stand corrected.

Same issue here. QLThumbnailGenerator caches the custom Folder icon it seems....once it's loaded it seems to always reuse that image.

No public API I'm aware of to clear the thumbnail cache?

Also just noticed that it isn't just the Emoji/SF symbol badge.

When the folder is not empty QLThumbnailGenerator makes a folder icon with paper sticking out (indicating that the folder is not empty). When the folder is empty no paper is sticking out. So if a folder is emptied out after your app is run the icon will still show the papers sticking out like it isn't empty and vice versa.

I can think of a workaround for both issues but real pita like the bread

FB21171975

Strangely, I am not getting any customised thumbnail for a folder with an emoji using QLThumbnailGenerator. I am using the exact same code as the thread starter on macOS 26.1.

QuickLook Thumbnailing returns stale macOS 26 folder icon
 
 
Q