2

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 insertObject: in NSManagedContext then? It works without invoking that method after using the one in NSEntityDescription. Could somebody explain?

NSManagedContext

insertObject:

NSEntityDescription

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

1 回答 1

3

您可以使用上下文创建 NSManagedObject,nil然后决定是否要将其添加到上下文中。你可能也喜欢这样:有没有办法在不插入的情况下实例化一个 NSManagedObject?

于 2012-05-24T07:13:23.167 回答