Sandboxing save and load file

I looked through the forum but can’t seem to find the very basic information : can I save a file with a dialog as Mac apps do, or load a file the same way in a sandboxed app ? When I try to do it I get an error, but I may be missing something. Is there some sort of call, or a particular method to use to open rights ?

I would like the user to be able to save wherever he pleases, for instance within a folder in Documents, as it seems natural to do…

Yes, you certainly can, sandboxes or not. Without info on the error you are getting or any code, I can’t speculate on what you may be doing wrong.

Sounds like you need to add com.apple.security.files.user-selected.read-write to your entitlements file when you do the codesigning…
This allows the user to select any file and your app will have full access to the file. Access only lasts until the app quits, for access on subsequent runs, you’ll need to create and store security scoped bookmarks for each file.

https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6

I tested with the very simple piece of code :

Dim f As FolderItem
Dim fileStream as TextOutputStream
f=GetSaveFolderItem(“TEXT”,“My Info”)
If f <> Nil then
fileStream=TextOutputStream.Create(f)
fileStream.WriteLine “line 1”
fileStream.WriteLine “line 2”
fileStream.WriteLine “line 3”
fileStream.Close
End if

I use App Wrapper Mini, and I had forgotten to check “Open & Save Dialogs : Read & Write”. Nothing happened when I tried to pull the dialog.

Now that I have, it took care of the necessary file, and everything is allright. I freaked too early.

Thanks