iOS Development--Project Combat Summary & Data Persistence analysis

Source: Internet
Author: User

Data Persistence analysis

    • plist file (attribute list)
    • Preference (preference setting)
    • Nskeyedarchiver (archive)
    • SQLite 3
    • CoreData

What do you do when you store large chunks of data?

You have many options, such as:

    • Use ' Nsuerdefaults '

    • Using XML, JSON, or plist

    • Using Nscoding Archive

    • Using a local SQL database similar to SQLite

    • Using Core Data

What is the problem with Nsuserdefaults? Although it is very nice and convenient, but it only applies to small data, such as some simple Boolean settings options, and then you need to consider other ways

What about this structured file of XML? Overall, you need to read the entire file into memory to parse it, which is very economical. Using sax is another tricky thing to do.

Nscoding? Unfortunately, it also needs to read and write files, so there are the above problems.

In this scenario, it is better to use SQLite or Core data. Using these techniques, you can load only the objects you need with specific query statements.

In terms of performance, SQLite and core data are very similar. Their difference is in the use of specific methods. Core data represents the graph model of an object, but SQLite is a DBMS. Apple generally recommends using core Data, but if you have a reason not to use it, then use the more basic SQLite.

If you use SQLite, you can use Fmdb (Https://github.com/ccgus/fmdb) This library to simplify the operation of SQLite, so you do not have to spend a lot of experience to understand SQLite C API.

iOS Development--Project Combat Summary & Data Persistence analysis

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.