The difference between SQLite and CoreData:
Operation Flow of 1.sqlite database:
Create a database and define a table structure by defining some fields, you can use SQL statements to insert records into a table, delete records, modify records, and create links between tables.
The SQLite and CoreData classes do a correspondence:
Table Structure--------nsentitydescription (menu details)
All the tables in the database and their contact--------Nsmanagedobjectmodel (Recipes)
How the database is stored---------nspersistentstorecoordinator (chef)
Query Statement-----nsfetchrequest (requirements)
Table records------Nsmanagedobject (Entity management Class)
Database operations------Nsmanagedobjectcontext (Miss Waiter)
2.coredata Part Knowledge
Nsentitydescription,nsmanagedobjectmodel
Nsentitydescription is used to define the structure of the table, so you can understand the setentities (Nsarray *) entities function in Nsmanagedobjectmodel is probably useful. The model is usually defined, which is a graphical operation using the file Coredata.xcda****odel, which is similar to creating an interface with NIB.
Create a new project, use CoreData, after the emulator runs, the program corresponding to the document directory appears a coredata.sqlite, you can use the Sqlite3 command to view the structure of the table inside
Nspersistentstorecoordinator
The object of this class is initialized with Nspersistentstorecoordinator object, there are some methods to add, delete Nsmanagedobject
Nsfetchrequest
You typically use nsentitydescription to construct a query, you specify the query for that table, and you can specify a sort
In the CoreData design, the next layer has corresponding properties pointing to the previous layer, so nsmanagedobject has properties to get nsentitydescription,nsentitydescription, There are attributes to get nsmanagedobjectmodel.
As for the class
Nsfetchedresultscotroller, just another seal, and nsfetchrequest together to use, easy to access data, and nsmanagedobjectcontext associated with the database when the change to receive notification
The difference between SQLite and CoreData in iOS