Essentials Summary of how iOS app data is stored

Source: Internet
Author: User

1. What can be done plist storage

1.writeToFile (Must have this method)

Dictionary and array can;

String: Although it is possible to do plist, the plist itself does not support strings.

2. The path must be expanded (when searching for a path (the third parameter must be YES)

If the no system will replace the sandbox path of your app with (~).

3. Note: Custom objects cannot be plist stored.

Preferred settings:

1. No need to care about file names

2. Fast storage of key-value pairs

3. The bottom layer is the encapsulation of UD as a dictionary

Remember to sync!!! before 4.ios8

Custom object archive/solve file:

1. If you want to store custom objects, you must use the archive/file operation

2.plist. Preference settings are not good enough to make

3. Be sure to follow the <NSCoding> protocol when customizing the object File/solution

4. When to call Initwithcoder as long as the parse file will be called

5. Remember to assign a value to a property when the properties of the file are being extracted!!!!

6. Why comply with <NSCoding> agreement?

What properties to tell the system to file/unpack

Tell the system how to archive the file

7. The suffix name of the file that holds the data can be named arbitrarily.

8. data saved through Plist is displayed directly and is not secure. The data saved by the archive method is garbled and more secure when it is opened in a file.

Get path:       

1. Get the Sandbox directory path function:
NSString *homedire = Nshomedirectory ();

2. How to obtain the Documents directory path:
Nsarray *paths = Nssearchpathfordirectoriesindomains (Nsdocumentdirectory,nsuserdomainmask,yes);
NSString *docdire = [Paths objectatindex:0];

3. How to get the caches directory path:
Nsarray *paths = Nssearchpathfordirectoriesindomains (Nscachesdirectory,nsuserdomainmask,yes);
NSString *cachesdire = [Paths objectatindex:0];

4. How to obtain the TMP directory path:

NSString *tmpdire = Nstemporarydirectory ();

Essentials Summary of how iOS app data is stored

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.