I have a simple Cocoa image preview app. The user selects a file using an NSOpenPanel
and the app generates a preview image using the Quick Look API.
I\
I'm not 100% sure but I think Apple recommends passing an NSFileHandle
to the XPC process in this case. That way, the XPC process can access the file's contents but does not need to know the file's URL.
Edit: This thread in the Apple Developer Forums is helpful. The recommendation is to create a normal (not security-scoped) bookmark for the URL of the file. This bookmark can then be passed to the XPC process and accessed by it.