QuickLook Thumbnailing

RSS for tag

Generate thumbnails for common file types and add a Thumbnail Extension to your app using QuickLook Thumbnailing.

Posts under QuickLook Thumbnailing tag

34 Posts

Post

Replies

Boosts

Views

Activity

macOS app rejected for Thumbnail extension continuing to run
I received a rejection for "Your app spawns processes that continue running after the user has quit the app." The process in question is the app's Thumbnail extension. When I remove all of my own code from the thumbnail extension, it still continues to run after I exit my app. This is the entirety of the extension's code, which now renders blank thumbnails: import QuickLookThumbnailing class ThumbnailProvider: QLThumbnailProvider { override init() { } override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) { let reply = QLThumbnailReply(contextSize: request.maximumSize) { (context: CGContext) -> Bool in return true } handler(reply, nil) } } Presumably Thumbnail extensions continue to run so that Finder (among others) can generate thumbnails as necessary. AFAIK, I have no direct control over the extension's lifecycle. Is this just App Review's mistake? The "Next Steps" are clueless: "You can resolve this by leaving this option unchecked by default, providing the user the option to turn it on." The app uses its own thumbnail extension to render thumbnails for document templates, which may be an uncommon thing.
1
0
1.6k
Aug ’23
Thumbnail images in iOS / iPadOS slow to update
Question asked during the 6-6-23 UIKit Q&A Slack session of WWDC 2023 My iOS / iPadOS / Catalyst app has a thumbnail extension with a QLThumbnailProvider subclass that implements the provideThumbnail(for:_:) method providing the thumbnail for a document created in my app, by drawing the thumbnail image into the current context. That implementation successfully updates the thumbnail for the document, but sometimes the thumbnail's displayed image (in, for instance, the Files app or my app's own UIDocumentBrowserViewController on iPhone or iPad) is slow to update. (This update slowness seems especially to be a problem for documents stored in iCloud Drive, rather than in local storage.) (1) Am I correct in presuming that the displayed thumbnail images are cached somewhere, and the reason the displayed thumbnail images are slow to update is because either (a) the thumbnail cache is slow to update and/or (b) the system only periodically calls the provideThumbnail(for:_:) method? (2) If so, is there some way my app can either (a) force the thumbnail image cache to update more quickly and/or (b) force the provideThumbnail(for:_:) method to be called, so that the displayed thumbnail images for the created/modified documents are quicker to update?
2
0
1.9k
Jun ’23
NSFileProviderReplicatedExtension + NSFileProviderThumbnailing fetchThumbnails never called
Hello, I am trying to add thumbnails to a replicated file provider extensions but the fetchThumbnails method never gets called. After adding the NSFileProviderThumbnailing protocol and fetchThumbnails method to my class I can see the change in behaviour in Finder when I click on a non materialised item as it displayed an empty space instead of the generic file type icon when the protocol is not added. I noticed the mention of caching based on itemVersion but I would still expect the fetchThumbnails method to be called for all newly enumerated items when Finder is in thumbnail mode ? Thanks,
1
0
1.3k
May ’23
Quicklook Thumbnailing not working in iOS 16 betas
Our app has a custom file format and implements a Quicklook Thumbnailing extension. In iOS 16 (through to the latest beta 8 release) thumbnails are not generated in the Files app. And also are not returned for calls to QLThumbnailGenerator. Apple's sample app for this shows the same problem: https://developer.apple.com/documentation/uikit/view_controllers/building_a_document_browser_app_for_custom_file_formats I rolled back to iOS 15 to be sure and both our app and Apple's sample work there but fail in iOS 16. The console shows: error 13:34:59.136343-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.136801-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.137602-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137767-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137841-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137948-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.138159-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.138283-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.620873-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.621362-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.622256-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block I filed feedback at the start of August (FB11066418) but have had no response. Is anyone else seeing this issue?
3
1
3.6k
Oct ’22
How to get thumbnail as base64 string (macOS)
I don't know how to make this function to return base64encoded string of thumbnail in jpeg format.     let request = QLThumbnailGenerator         .Request(fileAt: fileURL, size: size, scale: scale,                  representationTypes: .lowQualityThumbnail)     QLThumbnailGenerator.shared.generateRepresentations(for: request)     { (thumbnail, type, error) in         DispatchQueue.main.async {             if thumbnail == nil || error != nil {                 // Handle the error case gracefully.             } else {                 // return the thumbnail as bas64 string. return ...             }         }     } }
1
0
1.6k
Jul ’22
iOS Thumbnail Extension vs Network access
Is it possible to use network from within iOS Thumbnail Extension? I tried - it works fine under simulator, but I'm getting this error when running on real device: networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. Adding "App Transport Security Settings / Allow Arbitrary Loads" plist entry didn't help. As the error seems to be specific access to a particular file I tried adding "com.apple.security.temporary-exception.files.absolute-path.read-only" but it didn't help and looks like it couldn't help on iOS: "Note: This chapter describes property list keys specific to the macOS implementation of App Sandbox. They are not available in iOS."
3
0
3.1k
Mar ’22
thumbnail rendering just 6mb?
I'm getting Thread 5: EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=6 MB) My thumbnails do render (and they require more than 6mb to do so), so I wonder about the behavior here. Does the OS try to render thumbnails with a very low memory limit and then retry if that fails?
Replies
0
Boosts
0
Views
958
Activity
Oct ’23
Unable to generate thumbnail for public.image using QLThumbnailProvider in macOS app?
By Apple's documentation, QLThumbnailProvider is used to generate thumbnails for custom file types. However i am trying to use it to generate thumbnails for public.image file type and it is not working. So can we override the system supported thumbnailer using QLThumbnailProvider?
Replies
1
Boosts
0
Views
1k
Activity
Sep ’23
macOS app rejected for Thumbnail extension continuing to run
I received a rejection for "Your app spawns processes that continue running after the user has quit the app." The process in question is the app's Thumbnail extension. When I remove all of my own code from the thumbnail extension, it still continues to run after I exit my app. This is the entirety of the extension's code, which now renders blank thumbnails: import QuickLookThumbnailing class ThumbnailProvider: QLThumbnailProvider { override init() { } override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) { let reply = QLThumbnailReply(contextSize: request.maximumSize) { (context: CGContext) -> Bool in return true } handler(reply, nil) } } Presumably Thumbnail extensions continue to run so that Finder (among others) can generate thumbnails as necessary. AFAIK, I have no direct control over the extension's lifecycle. Is this just App Review's mistake? The "Next Steps" are clueless: "You can resolve this by leaving this option unchecked by default, providing the user the option to turn it on." The app uses its own thumbnail extension to render thumbnails for document templates, which may be an uncommon thing.
Replies
1
Boosts
0
Views
1.6k
Activity
Aug ’23
Thumbnail images in iOS / iPadOS slow to update
Question asked during the 6-6-23 UIKit Q&A Slack session of WWDC 2023 My iOS / iPadOS / Catalyst app has a thumbnail extension with a QLThumbnailProvider subclass that implements the provideThumbnail(for:_:) method providing the thumbnail for a document created in my app, by drawing the thumbnail image into the current context. That implementation successfully updates the thumbnail for the document, but sometimes the thumbnail's displayed image (in, for instance, the Files app or my app's own UIDocumentBrowserViewController on iPhone or iPad) is slow to update. (This update slowness seems especially to be a problem for documents stored in iCloud Drive, rather than in local storage.) (1) Am I correct in presuming that the displayed thumbnail images are cached somewhere, and the reason the displayed thumbnail images are slow to update is because either (a) the thumbnail cache is slow to update and/or (b) the system only periodically calls the provideThumbnail(for:_:) method? (2) If so, is there some way my app can either (a) force the thumbnail image cache to update more quickly and/or (b) force the provideThumbnail(for:_:) method to be called, so that the displayed thumbnail images for the created/modified documents are quicker to update?
Replies
2
Boosts
0
Views
1.9k
Activity
Jun ’23
NSFileProviderReplicatedExtension + NSFileProviderThumbnailing fetchThumbnails never called
Hello, I am trying to add thumbnails to a replicated file provider extensions but the fetchThumbnails method never gets called. After adding the NSFileProviderThumbnailing protocol and fetchThumbnails method to my class I can see the change in behaviour in Finder when I click on a non materialised item as it displayed an empty space instead of the generic file type icon when the protocol is not added. I noticed the mention of caching based on itemVersion but I would still expect the fetchThumbnails method to be called for all newly enumerated items when Finder is in thumbnail mode ? Thanks,
Replies
1
Boosts
0
Views
1.3k
Activity
May ’23
Quicklook Thumbnailing not working in iOS 16 betas
Our app has a custom file format and implements a Quicklook Thumbnailing extension. In iOS 16 (through to the latest beta 8 release) thumbnails are not generated in the Files app. And also are not returned for calls to QLThumbnailGenerator. Apple's sample app for this shows the same problem: https://developer.apple.com/documentation/uikit/view_controllers/building_a_document_browser_app_for_custom_file_formats I rolled back to iOS 15 to be sure and both our app and Apple's sample work there but fail in iOS 16. The console shows: error 13:34:59.136343-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.136801-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.137602-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137767-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137841-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.137948-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.138159-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.138283-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block error 13:34:59.620873-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.621362-0700 LocalStorageFileProvider [ERROR] Creating internal error for "startFetchThumbnailOperationOverall", original error was: NSError: Cocoa 3328 "<private>" error 13:34:59.622256-0700 com.apple.quicklook.ThumbnailsAgent Failing <private>, which did not get a per-thumbnail download completion block I filed feedback at the start of August (FB11066418) but have had no response. Is anyone else seeing this issue?
Replies
3
Boosts
1
Views
3.6k
Activity
Oct ’22
How to get thumbnail as base64 string (macOS)
I don't know how to make this function to return base64encoded string of thumbnail in jpeg format.     let request = QLThumbnailGenerator         .Request(fileAt: fileURL, size: size, scale: scale,                  representationTypes: .lowQualityThumbnail)     QLThumbnailGenerator.shared.generateRepresentations(for: request)     { (thumbnail, type, error) in         DispatchQueue.main.async {             if thumbnail == nil || error != nil {                 // Handle the error case gracefully.             } else {                 // return the thumbnail as bas64 string. return ...             }         }     } }
Replies
1
Boosts
0
Views
1.6k
Activity
Jul ’22
iOS Thumbnail Extension vs Network access
Is it possible to use network from within iOS Thumbnail Extension? I tried - it works fine under simulator, but I'm getting this error when running on real device: networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. Adding "App Transport Security Settings / Allow Arbitrary Loads" plist entry didn't help. As the error seems to be specific access to a particular file I tried adding "com.apple.security.temporary-exception.files.absolute-path.read-only" but it didn't help and looks like it couldn't help on iOS: "Note: This chapter describes property list keys specific to the macOS implementation of App Sandbox. They are not available in iOS."
Replies
3
Boosts
0
Views
3.1k
Activity
Mar ’22