NSPredicate在数组中排除“name”

时间:2012-02-13 15:20:40

标签: iphone objective-c ios nspredicate

我有这个名字(listsName)数组,我想在fbFriends数组中过滤掉并删除。我怎么能这样做?似乎我的条款不起作用。

// 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]; 

1 个答案:

答案 0 :(得分:3)

应为@"not (name in %@)"