Format arguments inside quotation marks are not expanded by predicateWithFormat
,
therefore @"%K like '%@*'"
does not work.
This should work:
NSString *pattern = [NSString stringWithFormat:@"%@*", whereAreYou];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K LIKE %@", NSMetadataItemFSNameKey, pattern];