Try this:
NSString *propertyName = @"type";
NSArray *eventsArray = [[[self currentPerson] events] allObjects];
NSPredicate *predicte = [NSPredicate predicateWithFormat:
@"%k like %@",propertyName, filteredWord];
NSArray *filteredArray = [eventsArray filteredArrayUsingPredicate:predicte];
You ignore the filtered result. The filteredArrayUsingPredicate:
returns a new instance of NSArray
. It doesn't filter the original
array in place, because NSArray
objects are immutable. You either
have to make an
NSMutableArray
and then use filterUsingPredicate:
to filter the array in place, or
you have to do something with the returned array of
filteredArrayUsingPredicate:
(log it, save it etc...)
Don't use single quotes around the property. (thanks for the clue @MartinR)