objective c - Apply filteredArrayUsingPredicate on specific column of a multidimensional NSMutableArray -
i have multidimensional mutable array contains various objects in each dimension.
position 1 = foodid int, position 2 = itemname nsstring
ie.
row 1 [1, "jif"]; row 2 [2, "skippy"]; row 3 [3, "peter pan"];
when try use following code below throws exception because tries evaluate position 1 string
//---get peanut butter types beginning letter--- nspredicate *predicate = [nspredicate predicatewithformat:@"self beginswith[c] %@", alphabet]; nsarray *beginwith = [food filteredarrayusingpredicate:predicate];
exception
'nsinvalidargumentexception', reason: 'can't substring operation isn't string'
can on how can filter using predicate specific column of multidimensional array?
there various examples of nsdictionary can applied key can't seem apply specific position in array.
you trying find or filter array using predicate main datasource ("food") array have array kind of object. , in predicate formula trying find string object in "food" array every object have array crashed , not able filtered array. hope understand comments.
Comments
Post a Comment