I have this to-many relationship which contains at least one element:
Appointment <<------>> Invitee
appointment.invitees
is an ordered relationship resulting in an NSOrderedSet
.
In a table view controlled by a fetched results controller, I have the appointments listed, along with the first element of the invitees set.
Now I want to search this list by invitees' names, using an NSPredicate
. But how can refer to the first element of the ordered list in the predicate?
I tried:
fetchRequest.predicate = [NSPredicate predicateWithFormat:
@"invitees[FIRST].lastName CONTAINS[cd] %@", searchTerm];
but I get the unimplemented SQL generation for predicate
error. This would make sense, as the result is a collection, but not strictly an array. Still, I think that the sqlite store must be modeling the order, so it should be retrievable.
Any advice?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…