• 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
Re: Some help with NSComparisonPredicate please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some help with NSComparisonPredicate please


  • Subject: Re: Some help with NSComparisonPredicate please
  • From: Keary Suska <email@hidden>
  • Date: Fri, 17 Feb 2017 08:25:53 -0700

> On Feb 17, 2017, at 7:41 AM, sqwarqDev <email@hidden> wrote:
>
> So eventually I discovered that this question has a history. Back in 2008 Keary and Garriet discussed this:
>
> http://webcache.googleusercontent.com/search?q=cache:HXWdzJeGeDcJ:www.cocoabuilder.com/archive/cocoa/208612-nspredicate-containing-contains.html+&cd=4&hl=th&ct=clnk&gl=th&client=safari
>
>
> Alas, none of that worked for me, but that’s exactly the same problem as described.
>
> I also found some history of it on SO, but I don’t understand the “solution” - which the asker confusingly says “I marking this as the solution even though it doesn’t answer my question because my question was misleading”.
>
> http://stackoverflow.com/questions/11476466/use-an-nspredicate-to-detect-not-contains
>
> I’ve tried all the %K and so on options. I’ve actually even downloaded Xcode 4 and built a test project in 10.7 Lion so I could debug it directly. Always the same error:
>
> “Unknown type of NSComparisonPredicate given to NSMetadataQuery”.
>
> LIKE works, but as I said doesn’t give me the right results. MATCHES fails, as does CONTAINS. I’m beginning to think this is a bug in NSMetadataQuery.

Have you read the File Metadata Search Programming Guide? You can find it here <https://developer.apple.com/library/content/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html#//apple_ref/doc/uid/TP40001849-CJBEJBHH> According to that document, only a very limited subset of predicate syntax is supported, and it uses special parsing rules. The correct syntax is probably:

	kMDItemFSName ==[c] *%@*

As long as the parser is OK with the %@ placeholder, which the docs don’t state directly so an alternative would be to construct the string before passing to -predicateWithFormat:

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Some help with NSComparisonPredicate please
      • From: sqwarqDev <email@hidden>
References: 
 >Some help with NSComparisonPredicate please (From: sqwarqDev <email@hidden>)
 >Re: Some help with NSComparisonPredicate please (From: sqwarqDev <email@hidden>)
 >Re: Some help with NSComparisonPredicate please (From: Shane Stanley <email@hidden>)
 >Re: Some help with NSComparisonPredicate please (From: sqwarqDev <email@hidden>)
 >Re: Some help with NSComparisonPredicate please (From: sqwarqDev <email@hidden>)

  • Prev by Date: Re: Some help with NSComparisonPredicate please
  • Next by Date: Re: Some help with NSComparisonPredicate please
  • Previous by thread: Re: Some help with NSComparisonPredicate please
  • Next by thread: Re: Some help with NSComparisonPredicate please
  • Index(es):
    • Date
    • Thread