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 (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