Reputation: 139
I try to get Core Data working with a simple one-to-many relationship in Xcode. My 2 entities, employee and department, are setup in the data model, and relationships are created: Employee has a to-one relationship to department Department has a to-many relationship to employee.
My xib has 2 table views for each entity. I wan to maintain my data there, selecting a department should show all employees, and I can add one more by using the insert method of that controller. My controllers ( one for each entity) have set:
Now, I thought the idea is to set the "Content Set" in the array controllers to manage the relationships. Like so: Department.selection.employee ( for employee ) Employee.selection.department ( for Department )
But all I get is a BAD ACCESS crash..
Any idea of what is wrong is welcome !
Upvotes: 0
Views: 163
Reputation: 15598
Don't use any of the content bindings of the departments array controller to show all departments. Bind the content set of the employees array controller to Department.selection.employees
. Department
is the department array controller, employees
is the to-many relationship.
Upvotes: 1