When linking 2 NSManagedObjects in code, is it required to link them both ways as follow?
Or is it enough to link only 1 of them to another?
The problem is that sometimes my first object loses the pointer to the second object, and I’m trying to find out why this is happening.
// Initialize firstObject
// Initialize secondObject
// Objects have 1 to 1 relationship
firstObject.secondObject = secondObject;
secondObject.firstObject = firstObject;
If you have linked the relationship both ways in the data model, then you do not need to write both these lines in your code. Just writing
firstObject.secondObject = secondObject;should be enough to link it both ways.