When using core data, how would I insert to values into a database, or even interact with a database. Is there a good tutorial for this? I have went over Core Data tutorial, but majority the files were done locally.
UPDATE
Someone from my previous question answered this
"Core Data can use a database to accomplish this, but that's it's business, not yours. When you use Core Data, it is a black box. You tell it to save the data and then step out of the way."
Does that mean it automatically does the database side for me?
Thank you!
Core Data is not a db manager, and does much more than simply interact with your db. At the very least, you should consider Core Data as an ORM. Perhaps, the best way to understand Core Data is to think it as a graph administrator. You are going to interact with core data via a context (
NSManagedObjectContext) that will let you fetch objects from it, and also insert, edit and delete them. Objects are subclasses ofNSManagedObject. One important thing to care about are threads.NSManagedObjectare not thread safe, you should never pass them between threads. UseNSManagedObjectsIDs instead. The important thing, you don’t need to care about how core data store things, you can set the format of the store, but that’s all (in that respect, you do have to take a few things into consideration when choosing the store, like performance, and whether you need to persist data between runs, but let’s Core Data handle the details).And if you want to know more, Marcus Zarra’s book is excellent