I would like to show a preview of the file contained in the pasteboard inside my sandboxed app. I'm able to do this using the QuickLookThumbnailing package.
Unfortunately, this requires a read access and does not work for files that are not inside the basics folders, such as Download, Video, Photo and Music.
For other cases I will get the error couldn't issue sandbox extension com.apple.app-sandbox.read for '<path to file>'
I understood that in the sandbox design, file's access are supposed to be approve from the user somehow. But in other application (sandboxed too), I can paste a file without being prompted for any confirmation.
How do they do this ?
Finder never provide a Security-Scoped Bookmark inside the pasteboard.
You don't get a security scoped bookmark but a path/URL that has read/write rights granted. You then create a security scoped bookmark and store it for subsequent access. This works for the general pasteboard (copy-paste) as well as for the drag clipboard.