I have an NSArray of NSDictionary. All the dictionaries have a key image-path
.
I want to get a filtered array of only the dictionaries that match a given value (content of my path
variable) for the key image-path
.
I validated the structure of the data I have using this line (it prints me all the values of the dictionaries for the key image-path):
NSLog(@"array key paths: %@", [mountedImages valueForKeyPath:@"image-path"]);
I am using this code:
NSString *path = @"value-I-want-to-match";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(image-path LIKE[cd] \"%@\")", path];
NSArray *filteredArray = nil;
filteredArray = [mountedImages filteredArrayUsingPredicate:predicate];
The last line crashes and produces the following error:
[ERROR] Computing 6571367.19831142 raised 'Unknown number type or nil passed to arithmetic function expression.'
I am doing this in a QuickLook plugin. I can step-through my code with gdb, but I don't seem to get any trace. I only get:
[...]
[ERROR] Computing 6571367.19831142 raised 'Unknown number type or nil passed to arithmetic function expression.'
[Switching to process 23335 thread 0x8903]
[Switching to process 23335 thread 0xa703]
[Switching to process 23335 thread 0x8903]
Program ended with exit code: 0