Last active
November 30, 2017 16:38
-
-
Save jazzedge/86ab3529ce3af292c4c83939a84da3c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Use Predicate - How can an NSPredicate test that a value contains one of two other values? | |
| See: https://stackoverflow.com/questions/47445895/how-can-an-nspredicate-test-that-a-value-contains-one-of-two-other-values | |
| I'm trying to write an NSPredicate that expresses: "If uid contains myID OR targetUser" | |
| If you'd wrote it in "code" and not in a predicate, you'd write if ([uid containsCD:myID] || (uid containsCD:targetUser]) not if ([uid containsCD:myID || targetUser]), where containsCD: is the equivalent of contains[cd]. Same logic for the predicate. | |
| Try: | |
| NSPredicate *p3 = [NSPredicate predicateWithFormat:@"(uid contains[cd] %@) OR (uid contains[cd] %@)", myID, targetUser]; | |
| Or, without brackets try: | |
| NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid contains[cd] %@ OR uid contains[cd] %@", myID, targetUser]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment