[IOS] IOS stores user data permanently.

Source: Internet
Author: User

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 useNSUserDefaultsClass 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"];

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.