我需要使用状态等于“U”过滤以下数组,并且我使用了以下内容。
NSArray *result = [alertModified.senders filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(subscriptions.status = %@)",@"U"]];
但我得到空数组。
请帮我过滤一下吗?
数组字符串:
(senderCode = CPFB, senderName = CPFB, forSenderLevel = 0, subscriptions = (
"correspondenceListId = 102,status = S,senderCode = AA,subject = Letter,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 103,status = U,senderCode = BB,subject = Nomination Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 104,status = U,senderCode = AA,subject = Yearly statements,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 105,status = U,senderCode = BB,subject = All Future Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = "))
答案 0 :(得分:0)
在您的示例中,您应该过滤订阅列表本身,而不是整个发件人。您必须将过滤器应用于每个发件人。尝试将过滤行更改为此并检查它是否为您提供结果:
NSArray *result = [[alertModified.senders objectAtIndex:0].subscriptions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(status = %@)",@"U"]];