insertNewObjectForEntityForName:...
返回NSManangedObject
与以下代码相同的对象。
NSManagedObjectModel *managedObjectModel =
[[context persistentStoreCoordinator] managedObjectModel];
NSEntityDescription *entity =
[[managedObjectModel entitiesByName] objectForKey:entityName];
NSManagedObject *newObject = [[NSManagedObject alloc]
initWithEntity:entity insertIntoManagedObjectContext:context];
return newObject;
entityForName:..
返回NSEntityDescription
与以下代码相同的对象。
NSManagedObjectModel *managedObjectModel = [[context persistentStoreCoordinator] managedObjectModel];
NSEntityDescription *entity = [[managedObjectModel entitiesByName] objectForKey:entityName];
return entity;