Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKError when querying system field: rejected "Unknown Field 'createdAt'"

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.

like image 792
BfromG Avatar asked Dec 17 '22 23:12

BfromG


1 Answers

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.
like image 66
Brian Hamm Avatar answered May 08 '23 21:05

Brian Hamm