我有一个 NSDictionary 的 NSArray。所有的字典都有一个键image-path
。
我想获得一个过滤数组,其中仅包含path
与 key 的给定值(我的变量的内容)匹配的字典image-path
。
我使用这一行验证了我拥有的数据的结构(它为我打印了关键图像路径的字典的所有值):
NSLog(@"array key paths: %@", [mountedImages valueForKeyPath:@"image-path"]);
我正在使用这段代码:
NSString *path = @"value-I-want-to-match";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(image-path LIKE[cd] \"%@\")", path];
NSArray *filteredArray = nil;
filteredArray = [mountedImages filteredArrayUsingPredicate:predicate];
最后一行崩溃并产生以下错误:
[ERROR] Computing 6571367.19831142 raised 'Unknown number type or nil passed to arithmetic function expression.'
我在 QuickLook 插件中执行此操作。我可以使用 gdb 单步执行我的代码,但我似乎没有得到任何跟踪。我只得到:
[...]
[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