How to create an entity dynamically in Objective-C?

I am creating an iPad application where I need a user to create an entity dynamically. I already have 3 objects that the program uses.
Could you help me with the code, how to do this?

I want to understand the whole structure in accordance with my understanding, I need to create a new managedObjectModel, add new entities and merge it with an existing one, is this correct?

+3
source share
2 answers

While in practice it is practically impossible to create a new entity and a new model, in practice it is very difficult. If you no longer have to transfer any existing persistent data to the new model and the new persistent storage file. I highly recommend not trying this, especially if you are just starting out with Core Data.

You have options:

First, are you sure you really need a new facility? People just starting out with Core Data often mistakenly accept objects for managed objects. Objects are managed objects because classes are instances. Objects are abstractions used to create a graph of objects. In fact, they do not contain data. The time when you need new entities is very, very rare.

-, - , , . . Person, , . Field, fieldName, fieldValue. Person, , Field. , , , .

, . . , , , .

+2

- NSEntityDescription, setEntities: . , , .

, , ( ). .

+2

Source: https://habr.com/ru/post/1777679/


All Articles