0

I am having issues to remove a reference relationship from a table.

I have the following user2reference added to the following table.

enter image description here

And I want just to remove this reference relationship from the table. It should look like this:

enter image description here

Tried to store an empty string or an CKReference with an empty recordName but does not work.

Raibaz
  • 9,280
  • 10
  • 44
  • 65
GuiSoySauce
  • 1,763
  • 3
  • 24
  • 37

2 Answers2

1

Or you can just do

record["user2reference"] = nil

After fetching the record from CloudKit

powertoold
  • 1,593
  • 13
  • 19
0

Try this:

database.fetchRecordWithID(CKRecordID(recordName: "user2reference"))
    {
        record, error in
        if let record = record
        {
            record.setObject(NSString(string: ""), forKey: "recordName")
            self.database.saveRecord(record) {_ in}
        }
    }
Yury
  • 6,044
  • 3
  • 19
  • 41