ios - CloudKit compound query (query with OR) -


i query cloudkit using or 2 fields. can't find way how this. did is:

nspredicate *predicate1 = [nspredicate predicatewithformat:@"(creatoruserrecordid == %@)", userid]; nspredicate *predicate2 = [nspredicate predicatewithformat:@"(touser == %@)", userid]; nscompoundpredicate *comppredicate = [nscompoundpredicate orpredicatewithsubpredicates:@[predicate1, predicate2]]; ckquery *query = [[ckquery alloc] initwithrecordtype:@"message" predicate:comppredicate]; 

but unfortunately ckquery not support or query (as written in documentation) can achieve effect other way?

ckquery supports , and not, imagine use simple boolean algebra create query based on fact not(not , not b) == or b. however, documentation says:

"the not compound operator not supported in following cases:

you cannot use negate , compound predicate."

so must query each of ored predicates separately save them each set , take intersection of 2 sets final result


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -