The documentation for NSMetadataQuery seems wrong. It implies that wildcards can be used along with the equality operator, to match substrings for metadata values. That is, you can do something like kMDItemAlbum == "*Ambient*", and it will match any item whose “album name” contains “Ambient”. The docs also imply that the NSPredicate like operator can’t be used in Spotlight queries.
But, duh, this is wrong. Using kMDItemAlbum like "*Ambient*" works just fine, but using == doesn’t work at all.
Also, the NSPredicate docs say that you can append operators to the end of your search, like c for case insensitive matching (so, kMDItemAlbum == "*Ambient*"c). But + predicateWithFormat: throws a hissy fit if I put operators after the query value.

Loading...
Post a Comment