Home > Articles > Home & Office Computing > Mac OS X

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Inserting a New Entity

Inserting a new object into a context is even easier than retrieving one from the context:

NSManagedObjectContext *context = [[NSApp delegate] managedObjectContext];
NSManagedObject *newObject = [NSEntityDescription

After the insertNewObjectForEntityForName:inManagedObjectContext: is called, the new entity is instantiated in the context. It will not be written to disk until the next save is called on the context. However, it is fully instantiated and ready to be used.

  • + Share This
  • 🔖 Save To Your Account