• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[NSPredicate predicateWithFormat:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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


  • Follow-Ups:
    • Re: [NSPredicate predicateWithFormat:]
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: First responder after alert
  • Next by Date: Re: Spotlight bindings example?
  • Previous by thread: Re: First responder after alert
  • Next by thread: Re: [NSPredicate predicateWithFormat:]
  • Index(es):
    • Date
    • Thread