I've got a Problem with my NSPredicateEditor. I want to use it for filtering a array of dictionarys.
NSArray events = {(Stadt=>Berlin), (Stadt=>Munich), nil }
The following code is working:
开发者_如何学Python predicate = [NSPredicate predicateWithFormat:@"Stadt LIKE %@", @"Berlin"];
NSLog(@"%@", predicate);
events = [events filteredArrayUsingPredicate:predicate];
The NSLog result is: Stadt LIKE "Berlin"
If I get the predicate from NSPredicateEditor I get the same NSLog result but the result array (events) is empty !
Code:
predicate = [predicateEditor predicate];
XLog(@"%@", predicate);
events = [events filteredArrayUsingPredicate:predicate];
Thanks, Andreas
NSPredicateEditor
does not have a -predicate
method. It has an objectValue
method, and you should use that instead. Perhaps you could provide more information, such as what is getting logged in the second block?
精彩评论