CoreData detailed steps for iOS database operations

Source: Internet
Author: User

CoreData

1. Common Classes and methods ( Note the need to import the coredata framework )

Table structure: nsentitydescription

Table record: Nsmanagedobject database storage method: Nspersistentstorecoordinator (persistent storage Coordinator) Database operations: Nsmanagedobjectcontext (Managed object context)

Technology blog http://www.cnblogs.com/ChenYilong/Sina Weibo http://weibo.com/luohanchenyilong

2. Xcode Graphics Management

2.3.4.

Technology blog http://www.cnblogs.com/ChenYilong/Sina Weibo http://weibo.com/luohanchenyilong

2.manipulating databases

Technology blog http://www.cnblogs.com/ChenYilong/Sina Weibo http://weibo.com/luohanchenyilong

I. Connecting the database
    1. You first need to create a context for the operational database. Nsmanagedobjectcontext
    1. The context of the operational database requires a scheduler attribute, which is used to graphically
      The established model and database are linked together.
    1. Add a database to the dispatcher that needs to be contacted.

Two. Add, UPDATE, delete

Add to:

1. New entity INST (insert) 2. Set the properties of an entity

3. Save the context update:

1. Determine if there is an identical model 2. Set entity Properties

3. Save context Delete three. Query

1. Using the Nsfetchedresultscontroller Controller

2.1 The proxy method of the fetch result controller is automatically invoked when the content of the manipulation data context changes

3.

Technology blog http://www.cnblogs.com/ChenYilong/Sina Weibo http://weibo.com/luohanchenyilong

Note: Be sure to perform a fetch request, and the returned data is in sections, and the array is loaded with objects that comply with the Nsfetchedresultssectioninfo protocol. Pass

Numberofobjects will be able to get a set of how many data objects.

Query tool Network: http://blog.csdn.net/ajrm0925/article/details/7410978 better document: Http://www.tuicool.com/articles/3mmIZn http:/ /blog.csdn.net/jiangshurunhe/article/details/10304309

CoreData third-party framework, with the official sample program:

Database Tools _coredata_magicalrecord-develop

Database Tools _coredata_magicalrecord-...
538.5 KB

CoreData detailed operation steps for iOS database operation (GO)

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.