我的CoreData的反比关系的理解是,这两个语句应该是等价的:CoreData逆问题
[department addEmployee:employee];
[employee setDepartment:department];
而且你只需要做其中之一。
但是,如果我这样做:
[department addEmployee:employee];
NSLog(@"%@",[employee department]);
它不会出现在的关系进行了正确更新。
做这不过这样一来,工作正常:
[employee setDepartment:department];
NSLog(@"%@",[employee department]);
我也打过电话“processPendingChanges”上的NSLog前的背景,但它不会有所作为