I am sorting the createdAt
system field like this:
query.sortDescriptors = [NSSortDescriptor(key: "createdAt", ascending: false)]
and get the following error:
CKError 0x1c4447fb0: "Invalid Arguments" (12/2018); server message = "Unknown field 'createdAt'"; uuid = 9C450848-2449-4892-93BC-C46363203042; container ID = "...
I am able to query and sort fields that I create in this manner. Anything different with a system field? The field's index is sortable and queryable.
Use creationDate
for the key, instead. The meta keys in the CK dashboard vary slightly from the ones used for queries. Here's a list of meta keys:
recordID: CKRecordID
The unique ID of the record.
recordType: String
The app-defined string that identifies the type of the record.
creationDate: Date?
The time when the record was first saved to the server.
creatorUserRecordID: CKRecordID?
The ID of the user who created the record.
modificationDate: Date?
The time when the record was last saved to the server.
lastModifiedUserRecordID: CKRecordID?
The ID of the user who last modified the record.
recordChangeTag: String?
A string containing the server change token for the record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With