Querying modifiedTimestamp in CloudKit

I have a requirement to get all records changed after a certain date. I have set modifiedTimestamp as Queryable, but when I attempt to do any query at all using the following operators: > < >= <= no results are returned. I have confirmed there are records that should be returned. The only operator that works is == and !=.

I have tried the following: NSPredicate(format: "modificationDate > %@", lastFetched as NSDate) NSPredicate(format: "___modTime > %@", lastFetched as NSDate)

Did you try with CloudKit Console yet?

If CloudKit Console returns the right result for the query with the same predicate, you confirm that the server side works well, and can focus on your code.

Otherwise, it may be that your CloudKit database isn't completely indexed, which can be because:

  1. Your index was just created, and indexing takes time for a large data set.
  2. CloudKit can't index the database for some reason.

For #2, you can try to remove and re-create the index to see if that changes anything.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Querying modifiedTimestamp in CloudKit
 
 
Q