ファイルのパスで文字列を検索するSpotlightクエリを作成しようとしています(ファイルの名前または含まれているフォルダーの名前のいずれかに一致させたい)。
NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat: @"kMDItemPath like[wcd] $SEARCH";
[query setPredicate:
[predicateTemplate predicateWithSubstitutionVariables:
[NSDictionary dictionaryWithObject:searchingFor forKey:@"SEARCH"]
]
];
[query startQuery];
次の場合でも、これは常に0の結果を返します。
NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat: @"kMDItemDisplayName in[wcd] $SEARCH";
1つ以上の結果を返します。私はこれをMacOSX10.5.8でテストしています。