NSDictionaryのNSArrayがあります。すべての辞書にはキーがありますimage-path
。キーの特定の値(変数
の内容)に一致する辞書のみのフィルター処理された配列を取得したいと思います。path
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