Where to save files in the iPhone app? Library / vs Application Support /, and subdirectory vs non-subdirectory

I want to save the custom preferences files of my iPhone application in the ~ / Library / directory. I don’t want to use the ~ / Documents / directory because I don’t want users to see or modify files in iTunes using the file sharing feature.

But there are 4 options for saving files to ~ / Library /:

1. ~ / Library / some-data.plist
This uses the library / directory without creating a subdirectory in it.
(API constant name is NSLibraryDirectory)

2. ~ / Library / MyAppName / some-data.plist
This uses a library / directory and subdirectory whose name is my application name.

3. ~ / Library / Application Support / some -data.plist
This uses the application support directory / without creating a subdirectory in it.
(The API constant name is NSApplicationSupportDirectory)

4. ~ / Library / Application Support / MyAppName / some -data.plist
This uses the application support directory / as well as a subdirectory named after my application name.

Questions

What are the advantages and disadvantages of each path above?
And where do you store your application data in Library /?

Should I use ~ / Library / or ~ / Library / Application Support /?

Should I create a subdirectory or not create one?
If I have to create a subdirectory, is it helpful to use the name of my application for the subdirectory?
Or are there better names for the subdirectory?

+3


source to share


1 answer


From: Filesystem Programming Guide



Place the support files generated by the application in the / Library / Application support / directory. In general, this directory contains files that the application launches, but which must remain hidden from the user. This directory can also include data files, configuration files, templates, and modified versions of resources loaded from the application bundle.

+1


source







All Articles