LuckyLuke LuckyLuke - 1 year ago 89
iOS Question

Inserting a new managed object in Core Data

I am new to Core Data and I feel that I don't get a hang of it. When you are going to create a new managed object you have to use the method that I pasted in at the bottom from the NSEntityDescription class.

Now is this object registered in the context, it is right? Why do you have the

in NSManagedContext then? It works without invoking that method after using the one in
. Could somebody explain?




+ (id)insertNewObjectForEntityForName:(NSString *)entityName inManagedObjectContext:(NSManagedObjectContext *)context

Answer Source

You can create NSManagedObject with nil context and then decide whether you want to add it to context or not. You may also like this: Is there a way to instantiate a NSManagedObject without inserting it?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download