我一直在尝试使用 NSPredicate 过滤这个数组(充满了 NSDictionaries)......
我有非常少量的代码无法正常工作......
以下代码应将 label.text 更改为 AmyBurnett34,但它不会...
NSPredicate *pred = [NSPredicate predicateWithFormat:@"id = %@", [[mightyPlistDict objectForKey:@"pushesArr"] objectAtIndex:indexPath.row]];
NSLog(@"%@",pred);
label.text = [[[twitterInfo filteredArrayUsingPredicate:pred] lastObject] objectForKey:@"screen_name"];
NSLog(@"%@",twitterInfo);
这就是得到 NSLoged 的内容......
2012-08-05 11:39:45.929 VideoPush[1711:707] id == "101323790"
2012-08-05 11:39:45.931 VideoPush[1711:707] (
{
id = 101323790;
"screen_name" = AmyBurnett34;
},
{
id = 25073877;
"screen_name" = realDonaldTrump;
},
{
id = 159462573;
"screen_name" = ecomagination;
},
{
id = 285234969;
"screen_name" = "UCB_Properties";
},
{
id = 14315150;
"screen_name" = MichaelHyatt;
}
)
如果你也 NSLog 这只是为了提醒......数组是空的......
NSLog(%@,[twitterInfo filteredArrayUsingPredicate:pred]);