I have two NSManagedObject subclasses, Person and Photo, that I am storing with CoreData. I need a comment object for a photo, and I was wondering if I should create a new NSManagedObject subclass and store it in core data, or create a subclass of nsobject and have an array of those in my Photo object? Which is the best thing to do? What are the pros and cons of each one?
2 Answers
1
votes
1
votes
If you have an array in Photo... Photo is a NSMagangedObject, so it would end up being store in core data if you want to keep them around. And that array would probably need to be converted in an NSValue...
Core Data is like a data base on many aspect, and in a data base you don't think arrays, you think tables.
So I strongly suggest NSManagedObject.
It would potentially allow you to query for all photos that have comments add or modified in a specific day. That thing would be extremely complicated to achieve with the array model you are proposing.