Can I use recordID.recordName in CKQuery?

CKQuery doc says: The key names used in the predicates correspond to the fields in the current evaluated record. Key names can include record metadata property names , such as "createDate" or any data fields added to the record.

What other metadata can I use in CKQuery ? Can I use record.recordID.recordName , if so, what is the key ?

+6
source share
1 answer

Yes, you can create CKQuery to search for the record identifier as follows:

 var query = CKQuery(recordType: recordType, predicate: NSPredicate(format: "%K == %@", "creatorUserRecordID" ,CKReference(recordID: theSearchRecordId, action: CKReferenceAction.None))) 

Where theSearchRecordId is the name of the recordID.recordName you are looking for

Metadata Fields: recordID, recordType, createDate, creatorUserRecordID, modifyDate, lastModifiedUserRecordID, recordChangeTag

See https://developer.apple.com/library/ios/documentation/CloudKit/Reference/CKRecord_class/index.html#//apple_ref/doc/uid/TP40014044-CH1-SW14

+13
source

Source: https://habr.com/ru/post/976312/


All Articles