I’m just about ready to send my app to the app store but I need to pick a place to save files that sandboxing won’t interfere with. What’s the best place to save files to on a Mac? Inside the app folder itself? Application Support? Somewhere else entirely?
On the Mac, sandboxed apps have a home directory that can be determined by calling NSHomeDirectory. For an app that is sandboxed, your files must go in that directory or one of its subdirectories.
Within the sandbox you have several directories to choose from. Which you use depends on what type of data you are storing.
NSLibraryDirectory
The directory containing application-related support and configuration files. If no other option fits your needs, put it here.
NSCachesDirectory
The directory containing discardable cache files.
NSApplicationSupportDirectory
The directory containing application support files.
For more information about sandboxing you OS X app, see OS X Sandboxing
For more information about the OS X file system, see OS X File System