Post

Replies

Boosts

Views

Activity

Result of NSMetadataQuery using predicateFromMetadataQueryString: is wrong
I'm trying to get an NSMetadataQuery to work using an NSPredicate build with: [NSPredicate predicateFromMetadataQueryString:@"InRange(kMDItemFSCreationDate,$time.today,$time.today(+1))"] That string is the one I copied from Finder's Get Info window after saving a search of "Created is Today". It at least parses and runs without exceptions, but the results are totally wrong. It only returns files created on 12/31/2000. I've tried dozens of different attempts at building a predicate that uses these $time functions, but they all fail parsing and throw an exception. What I really need to be able to do is build the predicate with a format string, because the attribute is stored in a property: [NSPredicate predicateWithFormat:@"InRange(%K,$time.today,$time.today(+1))", self.attr]; That throws an exception. [NSPredicate predicateFromMetadataQueryString:[NSString stringWithFormat:@"InRange(%@,$time.today,$time.today(+1))", self.attr]]; That does not throw an exception, but it gives the same 12/31/2000 results.
0
0
791
Oct ’20