我有一个多维可变数组,其中包含每个维度中的各种对象。
位置1 = foodID int,位置2 = itemName NSString
即。
Row 1 [1, "Jif"];
Row 2 [2, "Skippy"];
Row 3 [3, "Peter Pan"];
当我尝试使用下面的代码时,它会抛出异常,因为它试图将位置1评估为字符串
//---get all Peanut Butter Types beginning with the letter---
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet];
NSArray *beginWith = [food filteredArrayUsingPredicate:predicate];
异常
'NSInvalidArgumentException', reason: 'Can't do a substring operation with something that isn't a string'
任何人都可以帮助我如何使用谓词过滤多维数组的特定列?
NSDictionary有各种各样的例子,它可以应用于键,但我似乎无法将其应用于数组中的特定位置。