[NSPredicate predicateWithFormat:]
[NSPredicate predicateWithFormat:]
- Subject: [NSPredicate predicateWithFormat:]
- From: Hamish Allan <email@hidden>
- Date: Tue, 28 Jun 2005 16:15:18 +0100
Hi,
Why is it that when I try:
NSPredicate *predicate = [NSPredicate
predicateWithFormat:@"*=='foo.pdf'"];
I get:
2005-06-28 16:04:28.621 MDTest[4100] An uncaught exception was raised
2005-06-28 16:04:28.636 MDTest[4100] Unable to parse the format
string "*=='foo.pdf'"
2005-06-28 16:04:28.651 MDTest[4100] *** Uncaught exception:
<NSInvalidArgumentException> Unable to parse the format string
"*=='foo.pdf'"
whereas I can type, as a 'Raw Query' into Finder:
*=='foo.pdf'
*='foo.pdf'
*==foo.pdf
all of which work, or I can use:
NSPredicate *predicate = [NSComparisonPredicate
predicateWithLeftExpression:[NSExpression
expressionForKeyPath:@"*"]
rightExpression:[NSExpression
expressionForConstantValue:@"foo.pdf"]
modifier: NSDirectPredicateModifier
type: NSLikePredicateOperatorType
options: (NSCaseInsensitivePredicateOption |
NSDiacriticInsensitivePredicateOption)];
which also works.
Does the Finder use its own mechanism to parse the Spotlight query?
Thanks,
Hamish
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden