Permanent saving of user settings and Data
Luo chaohui (http://blog.csdn.net/kesalin)
Reprinted please indicate the source
To save user data or settings permanently, it is not affected by the re-installation of APP updates. We can only save this write data in the userdefaults or documents directory, these two locations have been explicitly supported in the official documentation.
For example:
<Application_home>/Documents/ |
You should write all application data files to this directory. This directory is used to store user data or other information that should be regularly backed up. For information about how to obtain the directory path, see the "get application directory path" section. ITunes backs up the contents of this directory. |
<Application_home>/Library/Preferences |
This directory contains the preference setting file of the application. Instead of directly creating preference files, you should useNSUserDefaults Class orCfpreferencesAPI to obtain and set application preferences. For more information, see "add settings package. ITunes backs up the contents of this directory. |
The documents directory can be obtained using the following code:
Nsstring * localpaths = nshomedirectory ();
Localpaths = [localpaths stringbyappendingpathcomponent: @ "documents"];