I am developing an app and I want access to the /User/<username>/Library/Containers
folder to read some data.
When iterating over the files, no data is returned until I open a NSOpenPanel
on that specific location. That behavior is to be expected, because the app is sandboxed.
I have another app installed that is called "AppManager" (sandboxed, available in the App Store). The app also reads data from that folder, but I only have to open the NSOpenPanel
on the /Applications
folder.
I read about the FileManager
method URLForDirectory:inDomain:appropriateForURL:create:error:
which seems to be a good starting point, but somehow this method is not available?
How (if possible) can a sandboxed app gain access to /User/<username>/Library/Containers
without opening a NSOpenPanel
? Can I gain access to more than one directory by opening only one NSOpenPanel
?
Regards, Sascha
You can't do anything without the NSOpenPanels
or dragging directories on your app - this is a security measure so the App Store apps don't trash data that doesn't belong to them
I saw programs ask the user to just select /
in NSOpenPanel
to get access to the whole drive. Again it is better to just ask for what you really need as you may not get past review. Some apps just have a separate UI to ask the user to NSOpenPanel
some directories for them and don't continue until you do.