Permanent saving of user settings and Data
Luo chaohui (http://www.cnblogs.com/kesalin)
This article follows the "signature-non-commercial use-consistency" creation public agreement
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/ |
all applications Program write 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 this directory path, see " Get application directory path " section. iTunes backs up the contents of this directory. |
/library/preferences |
This directory contains the preference setting file of the application. Instead of directly creating preference files, you should use nsuserdefaults class or cfpreferences API to obtain and set application preferences, for more information, see " add settings Collation package " section. iTunes backs up the contents of this directory. |
Here, the documents directory can be used as follows:CodeObtain:
Nsstring* Localpaths =Nshomedirectory();
Localpaths = [localpathsStringbyappendingpathcomponent:@ "Documents"];