For the problem of data persistence, bloggers are not prepared to put a lot of code in Beauvennes for a deeper explanation, just a brief introduction of the four data persistence, if there is time, will be additional for each data persistence method for further elaboration.
Go directly to the topic:
〈1,Nsuserdefault
Used to store configuration information, developers can use this instance object to modify the existing information, or to create new configuration items according to their own needs. This is a system of a single case, is a lightweight storage mechanism, generally used to store the user's login status, generally not used to store complex objects.
〈2,SQLite
Used for querying more data, good at dealing with the type of data is similar to Nsuserdefault, is also the basic type of small data, just from the organizational structure, developers can organize data in a relational database, using SQL, DML to manage the data, In general, the formatted text class data in the application can be stored in the database, especially similar to the chat record, Timeline and so on these have the conditional query and the sorting demand data.
〈3,coredata
is a management solution, is Apple's official push data persistence mode, has four classes, is a heavyweight storage mechanism, its persistence can be stored through SQLite, XML or binary files, it can be the entire file of the object model and automated management, (sleepy ... Go to bed first, then come tomorrow ... )
iOS Development _ Data storage method