Reputation: 6976
Suppose you have the following Core Data model:
An Entity named Event.
An Entity named Tag.
The relationship between Event and Tag is many to many. So a single Event will have multiple Tags and a Tag will point to many Events.
My problem:
How do you create an NSPredicate that will return an array full of Events that contain a specific tag?
I want to populate a UITableView with Events that have the Tag that the user will specify.
Upvotes: 0
Views: 779
Reputation: 539685
To fetch all objects that are related to the given tag, use
[NSPredicate predicateWithFormat:@"ANY tags == %@", givenTag];
Upvotes: 4