gpt4 book ai didi

iphone - NSPredicate 在数组中排除 "name"

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:50:43 27 4
gpt4 key购买 nike

我有这个名称数组 (listedName),我想在 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];

最佳答案

应该是@"not (name in %@)"

关于iphone - NSPredicate 在数组中排除 "name",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9262984/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com