1

I have a CKRecord with a CKReferenceList field. I want to add an additional CKReference to the CKReferenceList... I found this reference in stack overflow that gives a stellar example of how to download list from a CKReference List.

 var ksubs:[CKRecordID] = []
        for kSubscribers in record?.objectForKey("rexReferenced")  as! [CKReference] {
            ksubs.append(kSubscribers.recordID)
        }

But I need to do the inverse, I want to add an additional element to an existing CKreferenceList list. What is the CK equivalent to .append element?

Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159
user3069232
  • 8,587
  • 7
  • 46
  • 87

1 Answers1

0

Bon, managed to figure out how to ask the right question and found the answer here.

How to modify CloudKit Reference Lists

Its obvious isn't it.

CKReference *reference = [[CKReference alloc] initWithRecord:connectionRecord action:CKReferenceActionNone];
            NSMutableArray *list_a = [record_a[@"connections"] mutableCopy];
            if (!list_a) list_a = [NSMutableArray array];
            [list_a addObject:reference];
            record_a[@"connections"] = list_a;
Community
  • 1
  • 1
user3069232
  • 8,587
  • 7
  • 46
  • 87