mardi 12 juillet 2016

MSMetadataQuery predicate does not work for category

I have asked this before here but that answer is not working anymore.

This is the drill. I am using a NSPredicate to filter a NSMetadataQuery.

I want to get all images from that. So I thought about this predicate:

NSPredicate *predName = [NSPredicate predicateWithFormat:@"%K LIKE '*.*'", NSMetadataItemFSNameKey];

NSPredicate *predKind = [NSPredicate predicateWithFormat:@"%K == %@", NSMetadataItemContentTypeKey, @"public.image"];

NSCompoundPredicate *compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[predName, predKind]];

If I use that on NSMetadataQuery I get nothing. Even if I get zillions of images there, but if I change public.image to a kind like public.jpeg or public.png then I get files.

Why it is not responding to the main category?

Aucun commentaire:

Enregistrer un commentaire