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. 


Best


P

> On 17 Feb 2017, at 18:16, sqwarqDev <sqwarq...@icloud.com> wrote:
> 
> Suggestions from Shane and Steve:
> 
>> Use LIKE instead of CONTAINS? 
> 
> Yeah, that was my first thought. Alas, it doesn’t return the correct results. 
> 
>> Try quoting the right side? "kMDItemFSName contains[cd] '%@‘"
> 
> Doesn’t return the correct results in 10.11. There aren’t any spaces in my 
> actual target strings anyway (I know there was in the pseudo-code I gave, so 
> it was a good suggestion).
> 
>> Or use the uppercase CONTAINS?
> 
> That’s what it was originally, and then I tried changing it to lowercase 
> after the first crash.
> 
> Both ways cause the crash and the invalid NSPredicateComparison message in 
> 10.7.5.
> 
> There’s no question the format is valid in 10.9 and later. I just can’t 
> understand why Lion is objecting to it. I don’t really want to drop 10.7 
> users, but unless I can find a solution that’s going to be my only recourse. 
> 
> Anyone else got any thoughts? 
> 
> 
> 
> Best
> 
> 
> Phil
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/sqwarqdev%40icloud.com
> 
> This email sent to sqwarq...@icloud.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to