Search code examples
iosswiftcloudkit

Query CloudKit database with multiple record types


I have a cloud kit database set up and am trying to query against it. It looks like predicates won't work for what I'm trying to do.

In SQL the query would look something like this:

SELECT type1 FROM table1, table2 WHERE table1.columnA = table2.columnB

Also, similar to:

NSPredicate(format: "%K == %K" "key1", "key2") but that doesn't work either.

Again, because I am trying to match up key values I don't think predicates will work. Does anyone have any solutions?


Solution

  • you cannot query multiple recordType's with one query in CloudKit. You need to query 1 recordType first and then use that result for querying the 2nd recordType. The predicate you suggested only works if both fields are in the same recordType