• 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
NOT or NONE in NSPredicate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NOT or NONE in NSPredicate


  • Subject: NOT or NONE in NSPredicate
  • From: Chad Harrison <email@hidden>
  • Date: Thu, 17 Jul 2008 22:52:46 -0400

I have a fairly complex NSPredicate which works correctly, but I am trying to compound it with with a subpredicate that contains a logical NOT. I have tried using many combinations of the predicate syntax, but I can't seem to get it working. What I am trying to do it exclude files from being picked up based on an NSArray of names

these don't work

NSPredicate *doesNotContainTheseFilesPredicate = [NSPredicate predicateWithFormat:@"NONE (kMDItemFSName in %@)", myFileNameArray];

NSPredicate *doesNotContainTheseFilesPredicate = [NSPredicate predicateWithFormat:@"NONE kMDItemFSName in %@", myFileNameArray];


I also tried creating separate NSPredicates and then ANDing them together like


NSPredicate *doesNotContainThisFile1Predicate = [NSPredicate predicateWithFormat:@"NOT (kMDItemFSName LIKE %@)", @"filename.txt"];
NSPredicate *doesNotContainThisFile2Predicate = [NSPredicate predicateWithFormat:@"NOT (kMDItemFSName LIKE %@)", @"filename2.txt"];


predicateToRun = [NSCompoundPredicate andPredicateWithSubpredicates: [NSArray arrayWithObjects:predicateToRun,
doesNotContainThisFile1Predicate,
doesNotContainThisFile2Predicate,
nil]];


In some cases I just get an empty results, and in others I get "Unable to parse the format string"


Is there a better way to exclude files based on name alone?

thanks

_______________________________________________

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: NOT or NONE in NSPredicate
      • From: Phil <email@hidden>
  • Prev by Date: QCCompositionLayer for Manipulating other CALayers
  • Next by Date: Re: Chapter 6 Challenge Help!
  • Previous by thread: Re: QCCompositionLayer for Manipulating other CALayers
  • Next by thread: Re: NOT or NONE in NSPredicate
  • Index(es):
    • Date
    • Thread