Just want to confirm that I have this correct, and would like to see some sample code.
When I want to add a new record to Core Data, I create a new instance of an NSManagedObject subclass, correct? Then what? (Some sample 开发者_StackOverflowcode would be welcome.)
Assuming moc
is your managed object context and obj
is your newly created managed object,
[moc insertObject:obj];
// save to persistent store
NSError *error;
if (![moc save:&error]) {
// handle error
}
精彩评论