swift - NSCompoundPredicate and Cloudkit -


i'm trying compound predicate using cloudkit, xcode error says "unexpected expression". know wrong code? appreciate help!

let userref = ckreference(recordid: userid, action: .none)      let predicateone = nspredicate(format: "recordid in %@ , user = %@", postids, userref) // need user post's match ids in array , user id matches id in reference field user.      let predicatetwo = nspredicate(format: "recordid in %@", followids) // or want recordid's match ids in array. // want records if either predicate condition met, or both, why i'm using orpredicatetype.      let predicate = nscompoundpredicate(type: nscompoundpredicatetype.orpredicatetype, subpredicates: [predicateone!, predicatetwo!])     let query = ckquery(recordtype: "userposts", predicate: predicate)     let queryop = ckqueryoperation(query: query) 

there rules using nspredicate cloudkit. more information see apple documentation

what try create predicate this:

nspredicate(format: "recordid in %@ or (recordid in %@ , user = %@)", followids, postids, userref) 

but have bad experience using predicates both , and or statements in it. predicate not work, think solution executing 2 separate queries , combining result. using union function exswift library


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -