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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.