QuickLookThumbnailing: OK in iOS13, KO for iOS12

Hello,


I cannot get my thumbnail extension working under iOS12. I have created a new extension from Xcode 11 and linked the QuickLookThumbnailing framework as optional in the extension Link properties as it is not available under iOS12. The thumbnail extension works without issues under iOS13 but under iOS12 is never called. I also tried to link the QuickLook framework but I got the same result (extension not called).


Did anyone manage to get the QuickLookThumbnailing framework working under iOS12?


Thanks in advance for your help,

Libero

Accepted Reply

I finally managed to get the extension working under iOS12! I did the following:

1 - recreate from scratch the thumbnail extensionwith the Xcode 11.2 extension wizard

2 - change its deployment target to iOS 12

3 - change the extension plist to match the document type supported and the extension class

4 - link the extension with QuickLook framework as required and QuickLookThumbnailing as optional


YEAH!


Libe

Replies

See in doc that's for iOS 13+. Why do you expect it to work for iOS 12 ?:

Framework QuickLookThumbnailing

Generate thumbnails for common file types and add a Thumbnail Extension to your app to enable others to create thumbnails of your custom files.

SDKs

  • iOS 13.0+
  • macOS 10.15+
  • Mac Catalyst 13.0+


Hello,


thanks for your quick answer, I understand your point. From my understanding, all the thumbnail functionalities have been moved into a separated framework in iOS13 (from QuickLook to QuickLookThumbnailing) to be able to share it on macOS but I did not get that this removed support for iOS12...


Does anybody know how to support thumbnailing on both iOS12 and iOS13? I tried to link QuickLook as required and QuickLookThumbnailing as optional but I still cannot get the extension called under iOS12.


Thanks in advance for your help,

Libero

Contrary to what the framework info states, it's been deprecated.


Framework

QuickLook

SDKs
  • iOS 4.0+
  • macOS 10.5+
  • tvOS 12.1+
  • watchOS 5.1+
  • Mac Catalyst 13.0+
Framework

QuickLook


Here we see all func have been deprecated

QuickLook Functions


func QLPreviewRequestCopyContentUTI(QLPreviewRequest!) -> Unmanaged<CFString>!

Returns the UTI for the preview request.

Deprecated


func QLPreviewRequestCopyOptions(QLPreviewRequest!) -> Unmanaged<CFDictionary>!

Returns the options specified for the preview request.

Deprecated


func QLPreviewRequestCopyURL(QLPreviewRequest!) -> Unmanaged<CFURL>!

Returns the URL of the document for which a preview is requested.

Deprecated


etc…


func QLThumbnailCancel(QLThumbnail!)
Deprecated

func QLThumbnailCopyDocumentURL(QLThumbnail!) -> Unmanaged<CFURL>!
Deprecated

func QLThumbnailCopyImage(QLThumbnail!) -> Unmanaged<CGImage>!
Deprecated

func QLThumbnailCopyOptions(QLThumbnail!) -> Unmanaged<CFDictionary>!
Deprecated

func QLThumbnailCreate(CFAllocator!, CFURL!, CGSize, CFDictionary!) -> Unmanaged<QLThumbnail>!
Deprecated

func QLThumbnailDispatchAsync(QLThumbnail!, DispatchQueue!, (() -> Void)!)
Deprecated

func QLThumbnailGetContentRect(QLThumbnail!) -> CGRect
Deprecated

func QLThumbnailGetMaximumSize(QLThumbnail!) -> CGSize
Deprecated

func QLThumbnailGetTypeID() -> CFTypeID
Deprecated

func QLThumbnailImageCreate(CFAllocator!, CFURL!, CGSize, CFDictionary!) -> Unmanaged<CGImage>!

Creates a thumbnail image for the specified file.


func QLThumbnailIsCancelled(QLThumbnail!) -> Bool
Deprecated

func QLThumbnailRequestCopyContentUTI(QLThumbnailRequest!) -> Unmanaged<CFString>!

Returns the UTI for the thumbnail request.

Deprecated

func QLThumbnailRequestCopyOptions(QLThumbnailRequest!) -> Unmanaged<CFDictionary>!

Returns the options specified for the thumbnail request.

Deprecated

func QLThumbnailRequestCopyURL(QLThumbnailRequest!) -> Unmanaged<CFURL>!

Returns the URL of the document for which the thumbnail request is requested.

Deprecated


etc…


What happens when you call the former QLThumbnail functions for iOS 12 (does this compiles and links ?)


                if #available(iOS 13.0, *) {
                     // Use QLThumbnailGenerationRequest in QuickLookThumbnailing to generate thumbnails.
                } else {
                    // call QLThumbnailCreate() //  Use QuickLookThumbnailing for thumbnails.
                }


See here the corresponding API

h ttp://codeworkshop.net/objc-diff/sdkdiffs/macos/10.15/QuickLook.html

Hello,


I do not use any of the deprecated functions. What I am using is an implementation of a QLThumbnailProvider

API_AVAILABLE(ios(11.0), macos(10.15)) API_UNAVAILABLE(tvos, watchos) __attribute__((visibility("default")))
@interface QLThumbnailProvider : NSObject

/**
 Subclass this method to provide a QLThumbnailReply that either contains a drawing block or an image file URL.


 @param request An object which contains information about the thumbnail that should be provided. It contains the URL of the file to provide a thumbnail for.
 @param handler Call the completion handler with a QLThumbnailReply if you can provide a thumbnail, or with an NSError if you cannot.
                If an error is passed or reply is nil, no thumbnail will be drawn.
                The handler can be called asynchronously after the method has returned.
 */
- (void)provideThumbnailForFileRequest:(QLFileThumbnailRequest *)request completionHandler:(void (^)(QLThumbnailReply * _Nullable reply, NSError * _Nullable error))handler NS_SWIFT_NAME(provideThumbnail(for:_:));

@end

defined in QuickLookThumbnailing/QThumbnailProvider.h framework under iOS13. The same class is defined in QuickLook framework under iOS12.


I tried optional linking but does not work: extension is not called.


I also tried importing the QuickLook module and then the QuickLookThumbnailing one by using the @import statement in code with the Automatic Link Framework option on but the extension is still never called under iOS12...


I deeply regret having heavily invested into UIDocumentBrowserViewController...it's super broken on basic capabilities like this one... 😟


Libero

Did you call Developers support ? Link at the very bottom of this page

Contact Us

I finally managed to get the extension working under iOS12! I did the following:

1 - recreate from scratch the thumbnail extensionwith the Xcode 11.2 extension wizard

2 - change its deployment target to iOS 12

3 - change the extension plist to match the document type supported and the extension class

4 - link the extension with QuickLook framework as required and QuickLookThumbnailing as optional


YEAH!


Libe

Thanks for the feedback.


I never noticed extension wizard. Where is it in XCode ?

Check out this link: https://developer.apple.com/documentation/quicklookthumbnailing/providing_thumbnails_of_your_custom_file_types?language=objc


"To add a Thumbnail Extension to your app, select your project in Xcode’s Project navigator and make sure the General pane is visible. Select the + button and add a new Thumbnail extension to your app. Make sure to allow Xcode to create and activate a new build scheme for the extension."

Thanks.