开发者

Help with a Core Data Concept

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜