I am currently porting my data from Parse to CloudKit. I was able to import my data into the CloudKit structure, but now I am not receiving the correct amount of records. Instead of the 52 users (which are shown in the dashboard) I receive 289 records. I tried it with simple CKQuery and CKQueryOperation.
CKQuery returns 100 results due the limit and when I am using the CKQueryOperation i receive 289 results with many duplicate entries.
I use the following code (CKQuery way..) to fetch all my users:
let query = CKQuery(recordType: "User", predicate: NSPredicate(value:true))
let container = CKContainer.defaultContainer()
let publicDB = container.publicCloudDatabase
publicDB.performQuery(query, inZoneWithID: nil) { (records, error) in
print("USER public count: \(records?.count)")
}
And for the CKQueryOperation I have written a helper Library which is porting the result automatically into a swift class structure.
let uw = ROCloudBaseWebservice<User>()
uw.load { (data) in
logger.debug("User count (CKQueryOperation): \(data.count)")
}
If you want to see the code from this load you can see it here: https://github.com/prine/ROCloudModel/blob/master/Source/ROCloudBaseWebservice.swift
I have the same with my 3 other tables where I also get the wrong amount of data. Only one table which has 4 entries is receiving the correct amount of data.
Did anybody else have this problem? I am using References in the tables. Can this lead to a problem?