I have a simple Core Data iPhone app where Parents have a one-to-many relationship with Children. In the first view, you are presented with a list of Parents; tapping on one provides the corresponding list of Children. In the Child view, I want the each cell to show the Child name, and then the Parent name as a subtitle. I have used the following command:
cell.detailTextLabel.text = [[managedObject valueForKey:@"Parent"] description];
But instead of getting the parent name, the subtitle displays something like:
<Parent: 0x4d5a520> (entity: Parent; id...
Obviously I’m printing out the actual relationship, rather than the object’s name. How can I show the actual Parent name (“Mr Smith”)?
Thanks.
I managed to work it out! I’m gradually getting the hang of this programming thing… 🙂
I’ll leave the answer here in case someone else searches for it one day…
Instead of using a generic NSManagedObjectContext with KVC, I used my own subclass: