How to get a specific string in NSPredicate

How to get a string "NSMetadataItemFSNameKey == *"in NSPredicate? predicateWithFormatnot working and crashing.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "NSMetadataItemFSNameKey = *"'
+3
source share
1 answer

If you have a string @"NSMetadataItemFSNameKey == *"and want to turn it into a predicate, you cannot. This is distorted, so you get an exception.

It should be: @"NSMetadataItemFSNameKey == '*'". These single quotes around an asterisk are incredibly important.

+2
source

All Articles