This article is a simple comparison of 5 data persistence methods commonly used in iOS

Source: Internet
Author: User

1th: Userdefaults (iphone development "20" data persistence summary of the 1th article-nsuserdefaults)

1) Strong usability

2) data is stored in the. plist file

3) Generally save preference information, cache data, etc., for storing smaller amounts of data

4) Cons: Unable to serialize custom object to property list
2nd: Attribute list (iphone development "21" Data persistence Summary of 2nd-Properties file (. plist))

1) strong ease of use

2) data is stored in the. plist file

3) typically used for storing small amounts of data, nor for handling large amounts of data

4) Cons: Unable to serialize custom object to property list

This method is very similar to the 1th kind, the preference information, the cache data and so on generally uses the 1th kind, other situation generally uses the second method.
3rd: Archive (iphone development "22" data Persistence Summary of the 3rd-archive (Nskeyedarchiver, nskeyedunarchiver))

1) strong ease of use

2) data stored in archive file

3) typically used for storing small amounts of data

4) The biggest advantage is that complex objects can be written to the file can be archived collection classes, so no matter how many objects are added, the way the object is written to disk is the same, does not increase the workload;

If you cannot save complex objects with the property list of the 2nd method, the workload will increase with the object
4th: Sqlite3 (iphone development "24" data persistence Summary of the 4th article-sqlite3 database)

1) IOS-related APIs are C-language interface, and the design of the ease of use is not strong

2) data is stored in the. DB3 database

3) can store a large amount of data, storage, retrieval of large amounts of data is very efficient;

A complex aggregation of data can be much more efficient than using objects to perform these operations.

PS: Two commonly used frameworks for encapsulating sqlite3 operations Bnrpersistence Fmdb

5th: CoreData (iphone development "26" data persistence Summary of the 5th article-coredata Technology)

Similar to hibernate in Java

1) personal sense of ease of use is not strong

2) data storage can be selected Sqlite,xml,plist or otherwise as a persistence scheme, using SQLite generally

3) Advantages: the implementation of functions including Redo,undo, data validation, etc.

This article is a simple comparison of 5 data persistence methods commonly used in iOS

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.