Using .dylib in Quick Look Preview Extension target for macOS

I am developing "Thumbnail Extension" and "Quick Look Preview Extension" on Mac Apple M2 with Sonoma 14.5

These extension need 3rd party dynamic lib. (This .dylib I develop in Delphi FMX on Windows computer for macOS.ARM 64-bit architecture)

I was able to drag & drop this .dylib to "Thumbnail Extension" target in XCode, "Embed & Sign" on "General" tab and then use dllopen/dlsym/dclose to use it in .swift code - and it works as expected, generating thumbnails for my custom extension files.

However the same steps do not work for "Quick Look Preview Extension" target:

  1. The .dylib is drag & drop added to this target of my XCode project, "Embed & Sign" on "General" tab and build & run.
  2. I obtain "Previewer not found." dialog when SPACE-key viewing a file in Finder. (This happens even without calling dllopen/dlsym/dclose in my code.)
  3. After removing the .dylib from target "Quick Look Preview Extension" it works and shows my simple "generic hello world" graphic as Preview.

I have checked the container of app bundle on disk to make sure that .dylib is on correct place, and it is:

my.app/Contents/Plugins/Previewer.appex/Contents/Frameworks/libmydll.dylib

The size of this .dylib is 13.5 MB The .appex and .dylib are both signed, using "Development" signing certficate.

I am confused why this .dylib is working for "Thumbnail Extension" but not for "Quick Look Preview Extension". It seems to me that due to some reason system rejects to load this extension as soon as it contains .dylib, even without accessing it from my code.

Hello,

Thanks for sharing the detailed post. I understand you've successfully implemented a custom Thumbnail Extension. However you were unsuccessful attempted to create a Quick Look Preview Extension, as the underlying principles should be similar. Are both extensions developed within the same project with separate targets?

Could you please provide some information about your development environment? Specifically, the version of Xcode you're using, whether you're targeting macOS or Mac Catalyst, and any other relevant details. Additionally, it would be helpful if you could share your project settings for both extensions.

The more context you can provide, the easier it will be for us to identify any potential issues and suggest possible solutions.

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Related documentation:

https://developer.apple.com/documentation/quicklookthumbnailing

Using .dylib in Quick Look Preview Extension target for macOS
 
 
Q