Core Data reverse relationship not established

I have an object A with a to-many relation to B. B has property A, which is the inverse relation to A NSSet.

Pseudocode:

class A {
    NSSet * bConnections;
}

class B {
    A * aConnection;
}

In the model, I set the relationship as optional. For A, the relationship is defined as-many, the opposite of aConnection in B and eliminates the cascade of rules.

B is defined as optional, inverse to bConnection and the nullify delete rule.

When I create objects and add an NSSet from Bs to c [aInstance setValue:setOfBs forKey:@"bConnections"], the inverse relation to B is not set automatically. What am I doing wrong? Shouldn't it automatically update from Core Data?

Objects: initWithEntity:entityDescription insertIntoManagedObjectContext:managedObjectContext

+3
source share
2

mutableSetValueForKey:, . , , .

+1

, ; NSSet, A, Bs. NSSet , , , . JSON, , Bs A, .

+1

Source: https://habr.com/ru/post/1763446/


All Articles