Jimmy
Jimmy

Reputation: 21

NSManagedObject get parent object

I have an NSManagedObject who has a one to many relationship with the parent Object. How can I get the parent object using the child object?

Upvotes: 1

Views: 1774

Answers (1)

Marcus S. Zarra
Marcus S. Zarra

Reputation: 46718

You can set up a @property to access it and then call the @property

id parent = [myChild parent];

Or you can access it via KVC

id parent = [myChild valueForKey:@"parent"];

Upvotes: 1

Related Questions