Reputation:
If I have an album to songs one-to-many relationship, what is the proper way to set my fetchedresultscontroller to display songs for a given album?
Is my entity songs and my predicate:
[NSPredicate predicateWithFormat:@"album == %@", albumTitle]
Or is my entity albums with a different predicate that somehow reaches across to songs?
Upvotes: 0
Views: 622
Reputation: 10054
Assuming that your your song has a property album
, which in turn has a property title
:
[NSPredicate predicateWithFormat:@"album.title == %@", albumTitle]
or if you want malmo
to match Malmö
, you'd need:
[NSPredicate predicateWithFormat:@"album.title CONTAINS[cd] %@", albumTitle]
where c
denotes case insensitive search and d
denotes diacritic insensitive search.
For more information, refer to Predicate Format String Syntax Documentation.
Upvotes: 1