Pretty much everyone and every tutorial seems to store it's private app data in the documents directory.
But in my image editing app I want the user to be able to use iTunes file sharing. The problem: It exposes everything in documents to the user, and he can accidentally delete important private app data folders like the SQLite database.
Apple recommends this:
If you do not want files to be shared with the user, put them in your application’s Library directory. If none of the standard Library subdirectories are appropriate, create a private directory inside the Library directory and give it the name of your application’s bundle ID. You can then use that directory to store any files that are private to your application.
I have never heard of that Library directory. Now the question is: How can I access this directory? Where is it? Will it be backed up, just like the documents directory when the user syncs with iTunes?
Use NSLibraryDirectory
in lieu of NSDocumentDirectory
(in those examples you speak of) to get the library directory and then create a directory in there using NSFileManager
.
Read this
for more information on the application directory structure. The Library
directory is backed up except the Caches
directory.