0

I am attempting to query a CloudKit private database by comparing two date fields.

 let predicate = NSPredicate(format: "timeStamp == %@", parcoursTimeStamp as CVarArg)
            let query = CKQuery(recordType: "ParcoursRecord", predicate: predicate)
            privateDatabase.perform(query, inZoneWith: recordZone.zoneID, completionHandler: { (result, error) in
                if let error = error {
                    print("Error querying for record: \(error.localizedDescription)")
                } else {
                    print("Query result: \(result)")
                }

        })

I only receive Query result: Optional([ ]) but never any results although I know the timeStamps I am comparing are the same. What am I doing wrong? Is the predicate defined incorrectly (which would be me guess)?

Pete
  • 213
  • 1
  • 13

1 Answers1

0

Supposing that you timestamp CKRecord type has been defined as NSDate...

let predicate = NSPredicate(format: "timeStamp ==  %@", parcoursTimeStamp  as NSDate)
Adolfo
  • 1,862
  • 13
  • 19