I'm using an UIManagedDocument in my project and have to change the relationship of existing objects.
All objects already exist in the database so I'm not dealing with the temporaryID/permanentID issue. I'm also almost using updateChangeCount:
on my UIManagedDocument to save changes. So it shouldn't be an issue with the UIManagedDocument's usual suspects.
Model:
Company
|-- Department
|-- Employee
Operation:
Move a Department
from one Company
to another by calling [aDepartment setCompany:newCompany]
.
Situation 1 (succeeds):
Execute a fetchRequest on entity Department
calling company = newCompany
returns the expected result.
Situation 2 (fails):
Execute a fetchRequest on entity Employee
calling department.company = newCompany
returns no result.
Situation 2 only succeeds after UIManagedDocument auto-saves.
Any ideas how to solve this problem?