Accessing a file in the sandboxed main app, which was selected in a Finder Sync Extension

Hi there,

I have a Finder Sync extension, which adds a simply entry to the context menu of the finder. When this option is clicked, the selected files (URL objects) are sent to the main app using a URL Scheme. When I attempt to handle them there (e.g. read/write, access information about the file) I get a permission error. This only happens when using files from anything but the Downloads/Music/Pictures/Movies (all the folders which I already have given access to)

I know that this denying of permission when the user hasn't selected it is intended by the sandbox and that I can access them in the extension because they're selected, but this access gets lost as soon as I send them to the main app.

I simply can't find a way to send these paths to the main app without losing the aforementioned access, is there any way to do this, or am I forced to request full disk access from the user?

Post not yet marked as solved Up vote post of Elia314 Down vote post of Elia314
2.1k views

Replies

Standard practice here is to pass a security-scoped bookmark between the processes.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Hey, thanks for your answer!

    I researched about the topic using the docs, and have attempted to implement it. I am now accessing the URLs using FIFinderSyncController.default().selectedItemURLs() and then create a bookmark for every url using the bookmarkData function. Unfortunately with the error "Could not open() the item" (code 256), do you have any idea how I could fix this?

Add a Comment