Having difficulty debugging a iPhone Core Data bug?

It sounds like your data model (should) look like this: Speaker > Session Title > Session Where both Speaker and Title each have a to-many relationship to Session Based on this: I use a integer key to set up each relationship and your code, it looks like you are managing the relationships manually. Why are you doing this?! It is complicated and unnecessary.

Set up and use real relationships in your Core Data data model Also, do not use "id" for an attribute name since it is a keyword in objective-C.

It sounds like your data model (should) look like this: Speaker > Session Title > Session Where both Speaker and Title each have a to-many relationship to Session. Based on this: I use a integer key to set up each relationship. And your code, it looks like you are managing the relationships manually.

Why are you doing this?! It is complicated and unnecessary. Set up and use real relationships in your Core Data data model.

Also, do not use "id" for an attribute name since it is a keyword in objective-C.

Thanks, below is a copy of the data model. You are right about the basic layout.

The reason I'm setting the relationships manually is because this is the first time through the program so I'm doing the initial load of data from three separate plists (one for speaker, one for title, one for session).

Is there a better way to do this? I could be fundamentally not understanding core data but it seems as though if I just created a new title entity each time I created the session entity I'd have a one-to-one relationship from title to session rather than the one-to-many relationship that I want. Thus I put in the id variables (which I've now renamed with no change in the error) to act as a key for the first load into core data.

After that I'd of course use core data to manage all that. Is there a better way to do this?

Next, you should never post additional content for a question as an answer. You can edit your original question or create a new question if appropriate. – gerry3 Feb 23 '10 at 18:32 You can do the initial load from plists OR you could do the initial load during development, then save that database file and add it to your project.

Then, in your released app, you would copy the database file out of your read-only app bundle into the Documents directory. See stackoverflow. Com/questions/2265333/… – gerry3 Feb 23 '10 at 18:41 You do not understand Core Data relationships.

The first thing you should do is create subclasses for your entities. Then you can access the attributes and relationships through their names as properties of your objects. The to-many relationships are actually sets, so you can add a single object or a set of objects with methods that are provided for you when you create the subclass in Xcode.

– gerry3 Feb 23 '10 at 18:42 Yeah, my sincere apologies about my misuse of stack overflow. I accidentally posted my first post anonymously and so when I went to post a comment with additonal details I couldn't post a comment as myself because of my low rating. Anyway, I'll do better in the future.

I just figure out the error.In code above what I had posted I was using a fetchedResultsController on "title" to check to see if there were any results. I got rid of that and I was good to go. Thanks again for your patience with a noob.

– Martin Feb 23 '10 at 19:53.

I'm hoping someone can help me debugging an incredibly frustrating Core Data crash. I initially load data into two entities (representing 'speakers' and 'titles') I then load a third entity for 'sessions' and try to set relationships to 'speakers' and 'titles'. (from session to speaker and title is one-to-one.

From speaker/title back to session is one-to-many).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions