How to add a parent to CKRecord before NSPersistentCloudKitContainer will sync it?

Viewed 166

NSPersistentCloudKitContainer automatically creates all CKRecords for NSManagedObjects, so...

How to get access to this process and set CKRecord.parent before changes will be synched.

I need each CKRecord of type B to have parent record of type A, but avoid fully manual handling of setParent(:) as fully separate mechanism.

1 Answers

After you save to Core Data, you can get the CKRecord with the functions provided by NSPersistentCloudKitContainer read here.

Than you can set parent to record and save it to database with CKModifyRecordsOperation for example, yes you must use CloudKit operations for this to work.

Related