Access Desktop folder from appstore macOS application (sandboxed)

Hello,

I am writing a Desktop application for macOS with XCode.

This application will be available on app store. So, i have to put sandbox entitlement. So, this application won't be able to access Desktop folder. It will be jailed into a specific directory to store datas.

I have installed a macOS application from appstore. When I launched this application, I got a TCC prompt, asking me to allow this application to access Desktop (or Downloads I don't remember). How can this be possible ?

I have tried to write a sandboxed application which tries to access to Desktop folder. I didn't get any TCC prompt: My access was rejected.

How can I ask to access Desktop folder from I sandboxed application ?

Thanks a lot

Answered by JWWalker in 784711022

You can specify the entitlement com.apple.security.files.downloads.read-write for access to Downloads, but there is no similar entitlement for Desktop.

The correct way is to show an NSOpenPanel and ask the user to open the Desktop folder. Then store the security scoped bookmark.

Accepted Answer

You can specify the entitlement com.apple.security.files.downloads.read-write for access to Downloads, but there is no similar entitlement for Desktop.

Access Desktop folder from appstore macOS application (sandboxed)
 
 
Q