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?
                    
                  
                QuickLook Thumbnailing
RSS for tagGenerate thumbnails for common file types and add a Thumbnail Extension to your app using QuickLook Thumbnailing.
Posts under QuickLook Thumbnailing tag
            
              
                7 Posts
              
            
            
              
                
              
            
          
          
  
    
    Selecting any option will automatically load the page
  
  
  
  
    
  
  
              Post
Replies
Boosts
Views
Activity
                    
                      I'm implementing the 'new' QLThumbnailProvider for our macOS app...
So I just created the skeleton from Xcode, added our QLSupportedContentTypes in Info.plist, and have the skeleton code like below:
import QuickLookThumbnailing
class ThumbnailProvider: QLThumbnailProvider {
    override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) {
    // cannot trigger break point here!
}
I understand I should test the Thumbnail Extension by using:
$ qlmanage -t my_file.ext
Testing Quick Look thumbnails with files:
	my_file.ext
But I don't know what process to attach to in the Xcode debugger... a bit clueless...
I've skimmed relevant parts of https://developer.apple.com/videos/play/wwdc2019/719, but there is no real debug tips...
Does anyone know if it is possible to debug with Xcode or not? And if possible, then how? 😅
                    
                  
                
                    
                      I'm facing the same problem as addressed in this discussion: After switching from legacy QLGenerators to Preview extensions on macOS I cannot debug the extensions' code in Xcode, anymore:
I launch the app with the embedded appex from Xcode in debug mode. When trying to attach to the appex process the following error is reported:
Code: 6
Failure Reason: Ensure “AppName Preview” is not already running, and matthias has permission to debug it.
User Info: {...
}
System Information
 
macOS Version 15.4.1 (Build 24E263)
Xcode 16.3 (23785) (Build 16E140)
Timestamp: 2025-05-12T14:07:14+02:00
I'm using a standard user account (no admin) and might miss some obvious steps.
Can someone detail the steps to debug a Preview (or Thumbnail) extension with Xcode 16? For legacy Quick Look plugins I was using "qlmanage", but that's not working on extensions.
All the best, Matthias
P.S.: Pardon me re-posting my reply as a separate thread, to increase visibility, but I'm quite desperate and couldn't find any solution on the web...
                    
                  
                
                    
                      Since iOS 18.3.1,  In lower iOS versions it works fine though.
QLPreviewController shows a blank white screen instead of showing the document. Additionally, it does not display the 'Done' option at the top-right to close the view.
Presenting the QLPreviewController works fine to display the document, but for the second time, it renders the blank white screen as described.
While launching QLPreviewControllerView for the first time. I'm receiving the following message in the console and it displays the document.
LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
Attempt to map database failed: permission was denied. This attempt will not be retried.
Closing the QLPreviewController with the help of the 'Done' option from top-right or swipe to close triggers the following message in the console.
Connection to appex interrupted
AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:1022 (
	0   AXRuntime                           0x00000001d2cd7758 _AXGetPortFromCache + 796
	1   AXRuntime                           0x00000001d2cdd02c AXUIElementPerformFencedActionWithValue + 700
	2   UIKit                               0x0000000258cdf488 7F0274D9-D3C9-3193-B606-1C74BE53B86C + 1537160
	3   libdispatch.dylib                   0x0000000101bb888c _dispatch_call_block_and_release + 32
	4   libdispatch.dylib                   0x0000000101bba578 _dispatch_client_callout + 20
	5   libdispatch.dylib                   0x0000000101bc2454 _dispatch_lane_serial_drain + 840
	6   libdispatch.dylib                   0x0000000101bc325c _dispatch_lane_invoke + 408
	7   libdispatch.dylib                   0x0000000101bd06fc _dispatch_root_queue_drain_deferred_wlh + 328
	8   libdispatch.dylib                   0x0000000101bcfd0c _dispatch_workloop_worker_thread + 580
	9   libsystem_pthread.dylib             0x0000000225ea4680 _pthread_wqthread + 288
	10  libsystem_pthread.dylib             0x0000000225ea2474 start_wqthread + 8
)
Trying to open he document again, Ultimately results in the white blank screen to be displayed with no options to close.
It displays the Navigation bar only for the fraction of time. Leading users to force close the app and start again.
                    
                  
                
                    
                      We were using  below  delegate methods from QuickLook to get modified  PDF file  URL after the sketching  But we are not able see the multi line text properly laid out on PDF and part of text missing. Same time Other pencil kit tools are working as expected.
`func previewController(_ controller: QLPreviewController, didSaveEditedCopyOf previewItem: QLPreviewItem, at modifiedContentsURL: URL)
func previewController(_ controller: QLPreviewController, didUpdateContentsOf previewItem: any QLPreviewItem)`
We tested all code in iOS 18.2.
Please let us know if the text edited URL on PDF   can be retrieved in any possible way without tampering text
                    
                  
                
                    
                      I have an app on the Mac App Store (so sandboxed) that includes a QuickLook Preview Extension that targets Markdown files. It established a QLPreviewingController instance for the macOS QuickLook system to access and it works.
I'm in the process of updating it so that it displays inline images referenced in the file as well as styling the file's text. However, despite setting Downloads folder read-only access permission (and user-selected, though I know that shouldn't be required: no open/save dialogs here) in the extension's entitlements, Sandbox refuses too allow access to the test image: I always get a deny(1) file-read-data error in the log.
FWIW, the test file is referenced in the source Markdown as an absolute unix file path.
I've tried different signings and no joy. I’ve tried placing the referenced image in various other locations. Also no joy. All I can display is the error-case bundle image for 'missing image'.
Question is, is this simply something that QuickLook extensions cannot do from within the sandbox, or am I missing something? Is there anything extra I can do to debug this?
                    
                  
                
                    
                      I've developed a new Quicklook data-based preview extension for a custom file type that generates an image preview of the file. I previously used a Quick Look generator plug-in but support for it was deprecated and now removed in macOS Sequoia.
My app opens files using a
open(url.path, O_RDWR | O_NONBLOCK | O_EXLOCK)
call. The locking flags are used to prevent other clients from writing the file if it's already open.
I discovered that when Finder is showing the “large” file previews (such as when in column or gallery modes) from a SMB share, the open call fails with EWOULDBLOCK as if the file is locked.
It does work just fine on local files. Opening with O_SHLOCK also has the issue. Surprisingly it does work just fine for previews that return Plain Text data instead of Image data.
Using the lsof command, it seems like the Quicklook process has some kind of lock on the file.
This is the output of the lsof command:
COMMAND     PID    USER   FD   TYPE DEVICE  SIZE/OFF    NODE
QuickLook   48487  XXXX   txt  REG  1,15    125000611   3161369 
Attached is a test project that tries a few different opening and locking functions. It also includes a test file and a sample image preview extension that displays a red square.
When everything is working, regular console messages show the progress of the tests. When the file is on a SMB share and selected in Finder Gallery mode, the open test will fail with a fault message in the console.
Notably, locking with flock works, which is weird because it should have similar semantics according to the man page for open(2).
Filed this as FB15051186
                    
                  
                
              
                
              
              
                
                Topic:
                  
	
		App & System Services
  	
                
                
                SubTopic:
                  
                    
	
		General
		
  	
                  
                
              
              
                Tags:
              
              
  
  
    
      
      
      
        
          
            Extensions
          
        
        
      
      
    
      
      
      
        
          
            QuickLook
          
        
        
      
      
    
      
      
      
        
          
            QuickLook Thumbnailing
          
        
        
      
      
    
      
      
      
        
          
            Files and Storage