Objective c 如何使用特定键断言数组
我只是想用Product_Id断言我的数组Objective c 如何使用特定键断言数组,objective-c,nspredicate,Objective C,Nspredicate,我只是想用Product_Id断言我的数组 NSPredicate *pred=[NSPredicate predicateWithFormat:@"\"Product_Id\" ==%d",[[[_result valueForKey:@"Product_Id"] objectAtIndex:indexPath.row] integerValue]]; predicatedArray = [_likesArray filteredArrayUsingPredicate:pred]; _li
NSPredicate *pred=[NSPredicate predicateWithFormat:@"\"Product_Id\" ==%d",[[[_result valueForKey:@"Product_Id"] objectAtIndex:indexPath.row] integerValue]];
predicatedArray = [_likesArray filteredArrayUsingPredicate:pred];
_likesArray
具有以下字典数组
(
{
DeviceLikeStatus = 1;
Msg = "";
ProductCount = 1;
"Product_Id" = 116;
}
)
并且它没有任何谓词,总是显示谓词array
为空。谓词中不需要
试一试
使用“产品Id”而不是“产品Id”
NSPredicate *pred=[NSPredicate predicateWithFormat:@"Product_Id ==%d",[[[_result valueForKey:@"Product_Id"] objectAtIndex:indexPath.row] integerValue]];