Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSPredicate exclude "name" in array

I have this array of names (listedName) that I want to filter out and remove in fbFriends array. How I can do it? Seems my clause is not working.

// add "names" to listed name array
NSMutableArray *aTempFriendList = [[NSMutableArray alloc] init];
for (int n = 0; n < [[self friendsList] count]; n++) {
    NSDictionary *dFriend = [[self friendsList] objectAtIndex:n];
    NSString *sName = [dFriend objectForKey:@"name"];
    [aTempFriendList addObject:sName];
}

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name not in %@)", aTempFriendList];
[fbFriends filterUsingPredicate:predicate]; 
like image 455
jayr parro Avatar asked May 19 '26 21:05

jayr parro


1 Answers

It should be @"not (name in %@)".

like image 86
Gobra Avatar answered May 21 '26 13:05

Gobra