Search code examples
objective-cios8cloudkit

How to get recordID of CKReference


I'm using CloudKit and I have two record types. Record type B contains a CKReference to record type A. I'm not having any trouble getting record type B, including the CKReference data of record type A, but I can't figure out how to get the recordID from the CKReference record (record type A). Can anyone tell me how to do that?

Thanks!


Solution

  • recordID is a property of CKReference. Fetch the value from the record for the reference, then access the recordID property on that value.

    For example, if your reference value was named "AReference":

    recordB[@"AReference"].recordID