I have a cloudkit record with 5 fields:
Active
User1
User2
User3
User4
I am trying to pick the record where one of the 4 user fields match with
Cloud Kit's CKQuery
doesn't support OR
in a predicate. See the documentation for CKQuery
. It shows all the supported predicate operators and while AND
and NOT
are supported, OR
is not.
One possible replacement for OR
would be IN
. I've only seen this where you wish to see if a single field contains one of several values. But your case is in reverse. Try the following but it may not work.
var userID = "0984093843897"
NSPredicate(format:"%@ IN { %K, %K, %K, %K } AND active = true", userID, "userID1", "userID2", "userID3", "userID4"]