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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]