开发者

Obtaining the NSManagedObjectContext

开发者_开发百科

Well I was reading the Core Data tutorial for iOS on Apple's website and I don't quite get it.

How do I actually obtain the NSManagedObjectContext so I can use it to access to my database?


If you need to create a new context, just use alloc/init and then add a persistent store coordinator. This is described in Creating a New Managed Object Context. If you've already created a context in, say, your app delegate or root view controller, then you just need to pass it into your view controller when the controller is created. For example, the app delegate typically creates the root view controller. The app delegate can create the managed object context and then set the context in the controller.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜