user4234
user4234

Reputation: 1527

How to get all one to many relationship in Core data

NSArray * relationships = [entity.relationshipsByName allKeys];

Will return ALL relationships.

What about if I only want relationships that's one to Many? That is relationship that support selector count.

How would I do so?

Upvotes: 0

Views: 55

Answers (1)

Andrew Tetlaw
Andrew Tetlaw

Reputation: 2689

If you loop through the NSDictionary returned by entity.relationshipsByName, each value is an NSRelationshipDescription instance which has the property isToMany. You could pull out only the relationships where that property is true?

Upvotes: 1

Related Questions