0

我需要过滤状态等于“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 = "))
4

1 回答 1

0

在您的示例中,您应该过滤订阅列表本身,而不是整个发件人。您必须将过滤器应用于每个发件人。尝试将您的过滤器行更改为此并检查它是否为您提供结果:

 NSArray *result = [[alertModified.senders objectAtIndex:0].subscriptions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(status = %@)",@"U"]];
于 2012-04-16T15:04:30.673 回答