Will Sandboxing prevent this from working?

When I last wrote a Mac app, it was before the days of sandboxing and entitlements. Before I start converting an app to Swift (and learning Swift), I want to get confirmation that this is possible.

Will my app be able to open a file to analyze it? I don't have to be able to save the file; I only need access to the Mac's file structure and the ability to open a file that the user already has access to.

If so, I'm assuming that the user has to grant permission, either temporary or permanent. Is that done through the Security & Privacy dialog box in System preferences? Or will the user be prompted at runtime when the app tries to open a file?

Can such an app be approved for the Mac App Store?
Answered by DTS Engineer in 645807022

If so, I'm assuming that the user has to grant permission, either
temporary or permanent. Is that done through the Security & Privacy
dialog box in System preferences?

No. You typically do this through the standard open and save panels. If you present an open panel and the user uses that to choose a file, the system extends your app’s sandbox so that it can open that file.

There’s a bunch of info on this topic in the App Sandbox Design Guide.

Share and Enjoy

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

You will have to manage the bookmarks, it is a bit tedious but can be done.
Accepted Answer

If so, I'm assuming that the user has to grant permission, either
temporary or permanent. Is that done through the Security & Privacy
dialog box in System preferences?

No. You typically do this through the standard open and save panels. If you present an open panel and the user uses that to choose a file, the system extends your app’s sandbox so that it can open that file.

There’s a bunch of info on this topic in the App Sandbox Design Guide.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
No one can tell you ahead of time if an app will be approved for the Mac App Store.

You haven't been very clear about how this file is being opened. Does the user specify the file? If so, you should be OK. When there is clear "user intent" then you can almost always open a file for reading.

If the app opens the file on its own, then that's a whole different story. At the most pedantic level, the file system is "not an API" and you can't make any assumptions about it or rely on it.

You mentioned using System Preferences > Privacy and/or a runtime prompt. You are on shaky ground here. App Review expects an app to run and provide value to the user when run all by itself. But that I mean, if your app asks for access to the desktop, the App Reviewer will deny that access and most likely reject the app. Asking for any kind of special access is a red flag. Requiring any privileges in System Preferences is a hard no.
Will Sandboxing prevent this from working?
 
 
Q