• 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: sqwarqDev <email@hidden>
  • Date: Fri, 17 Feb 2017 06:54:14 +0700

Still looking for help with this, if anyone’s got any idea?

> On 15 Feb 2017, at 22:50, sqwarqDev <email@hidden> wrote:
>
> Building with Xcode 7.3.1, macOS 10.11.6
>
> I’m using an NSPredicate with the form:
>
> NSString *targetString = @“some string or other”;
> NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"kMDItemFSName contains[cd] %@“, targetString]];
>
>
> When I build and run my app, this runs fine on 10.9 and 10.11. However, when I build and run my app on 10.7, exercising the search function that calls the above code causes a crash and the following error:
>
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unknown type of NSComparisonPredicate given to NSMetadataQuery (kMDItemFSName CONTAINS[cd] “target filename”)’
>
> The docs tell me that:
>
> kMDItemFSName has been around since 10.4
> NSContainsPredicateOperatorType has been around since 10.5
>
> However, the docs also say that NSContainsPredicateOperatorType requires the left hand side to be a collection (array, set, dictionary), whereas I have a string. And yet, it works on 10.9 and later. My attempts at trying to put kMDItemFSName into an array on the left hand side have ended in build-time or run-time failures.
>
> Any thoughts on how I can get a ‘contains' query to run on 10.7?
>
>
> TIA
>
>
> Phil
>
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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: Shane Stanley <email@hidden>
    • Re: Some help with NSComparisonPredicate please
      • From: Steve Mills <email@hidden>
References: 
 >Some help with NSComparisonPredicate please (From: sqwarqDev <email@hidden>)

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