How to manage a big ManagedObjectModel with 6 entities and relationships? Core Data

176 views Asked by At

I would like to know how to manage a big Core Data ManagedObjectModel like this, but with more attributes in every entity. Proyectos(means Projects) and Desarrolladores(means Developers) will be a Table View. The other entities will be only items. I want to manage with singleTon for the fetchedResultController and to control the managedObjectContext Model

Does anyone knows about some examples like this? Big Models or something? All that I find is with only one entity or two.

Another question is that I am going to get all the data from JSON requests, so I want to know if I had to use NSPersistentStoreCordinator or I should use UIManagedDocument? This is other example

enter image description here

Thank you.

2

There are 2 answers

7
Juan Catalan On BEST ANSWER

I recommend using a sigle shared (Singleton) UIManagedDocument to ensure that you have the same UIManagedObjectContext for all the classes in your App.

Example on how to set this up can be found in thos blog:

http://www.adevelopingstory.com/blog/2012/03/core-data-with-a-single-shared-uimanageddocument.html

You can have several NSFetchedResultsController that will use this shared UIManagedObjectContext (from the shared UIManagedDocument).

This is a sample project I did for the Stanford course CS193p on iPhone programming. It uses Core Data with the sigleton I am proposing.

https://bitbucket.org/jcatalan007/cdspot

0
kmorris On

If you are using CoreData to cache data from JSON, you might want to look at https://github.com/RestKit/RestKit. It will take care of mapping between JSON objects and CodeData objects - potentially saving you a lot of code.

The model you show is not very large; examples in books and courses are deliberately small because they are only intended to teach. Real-world databases are always larger.