Hi im having a little problem with displaying a many to many relationship in core data.
Basically when I select a Event I can add a person to the event using the code
And I can print out the number of people related to then event (shown in NSLog) so I assume the above code is working.
The problem is I wish to show the people for each event in the table on the bottom left. As each "Person" returns a NSMutable set it isn't working.
I feel Im missing something blatantly obvious but can't put my finger on it.
Basically when I select a Event I can add a person to the event using the code
Code:
-(IBAction)addRelationShip:sender{
NSLog(@"Attempting to create a relationship");
NSArray *peoples=[allPeople selectedObjects];
People *person=[peoples objectAtIndex:0];
NSArray *events=[allEvents selectedObjects];
Event *event=[events objectAtIndex:0];
NSMutableSet *eventSet = [person mutableSetValueForKey:
@"events"];
[eventSet addObject:event];
[person setValue:eventSet forKey:@"events"];
}
And I can print out the number of people related to then event (shown in NSLog) so I assume the above code is working.
The problem is I wish to show the people for each event in the table on the bottom left. As each "Person" returns a NSMutable set it isn't working.
I feel Im missing something blatantly obvious but can't put my finger on it.