Local file access when building iOS app on M1 via "My Mac (designed for iPad)"

I am building an iOS / Swift app for my M1 Mac in XCode by selecting the build target of "My Mac (designed for iPad)" from the drop down list. I was wondering if it is possible to access local files on my mac ( e.g. /Users/Downloads etc ) via the usual FileManager APIs ( or any other way ) I'm NOT trying to access files in the app bundle or app documents directory.

I get a permissions error when trying to read a file or directory. I'm pretty sure I had done this in the simulator before, but that approach won't work here because I use some pre-compiled arm64 only libraries. I also tried Mac Catalyst but had similar build issues around my pre-compiled libraries.

Maybe there is a way to use arm64 simulator on the M1?

Thanks

Replies

Your app is automatically sandboxed when it runs on macOS.

That means that you only have access to files in your own container directories by default. Other files become available to you only if they have been explicitly selected by the user, e.g. by using an Open or Save dialog, or via Drag&Drop.