In short: Yes. It's possible, if I understand what you're talking about. Is it easy? No F'ing way. I just got done implementing core data and it was a real bitch. Most of the tutorials and examples floating out there don't do much good in explaining WTF is going on ... they just show you how to get it working, not how to get it working for what YOU want to do with it.
I wound up buying the eBook on the iPhone SDK from Pragmatic Bookshelf. It's got a chapter on Core Data. While it didn't go into much detail on relationships, it was a good start.
I've got a many-to-many relationship between two object models. I wound up creating a third object model to act as an intermediary ... it does one-to-many to my main objects, and thus in the end I've got a many-to-many relationship.
The real bitch for me was that I had to build in the Core Data implementation in stages. First I implemented one object model, and got it populated with a property list. Then, I'd start implementing the middle object model (keeping it ignorant of either of the two main models) ... get it populated with dummy data, just to make sure I had it working. Then I created the relationship from it to the first one, which broke my persistent store without telling me why it was failing. Then once I had that relationship working and populating, I went over to the third model and built it up by itself and populating with it's property list. Then I connected it over to the middle object model ... then magically it all works.
Apple's documentation on Core Data is a f*ing joke. I'm serious. Totally worthless.
The most powerful thing out of all of this is the predicates. But they also are the hardest to wrap your head around. No one has much GOOD documentation on how you should use them to get your crap together.
Quote:
Originally Posted by cation007
Hi,
I am trying to save and retrieve a hierarchy of objects. I know its not easy to do it with sqlite3.
Is it possible to do this with Core Data ? can I save all the objects and retrieve them, modify them save them back to file using core data?
Are they are sample code/ tutorial to do this?
Google didn't help me
Thanks for replying.
|