Obviously this code wasn't tested... which I don't understand. I deselected the ordered attribute from within the core data model editor and then had to alter several files to support these unordered relationships. I got it to compile and run. However, when I added a couple of devices to test cloud kit, it failed miserably. Only approximately 20% of the objects showed up on the other devices. I did see a ton of errors, as well.
For example:
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _recoverFromError:withMonitor:](1648): <NSCloudKitMirroringDelegate: 0x6000027328a0> - Recovered from error: <CKError 0x6000018176c0: "Limit Exceeded" (27/1020); "Your request contains 585 items which is more than the maximum number of items in a single request (400)">
and these messages on the mac app:
2019-07-20 14:31:13.815095-0700 CoreDataCloudKitDemo[26880:3701480] [AXCommon] Unable to broadcast 1001: err 268435459
2019-07-20 14:31:13.999978-0700 CoreDataCloudKitDemo[26880:3682834] [AXRuntimeCommon] AX Lookup problem - errorCode:1102 portName:'com.apple.iphone.axserver' PID:0 (
It amazed me because I didn't alter the code enough to challenge the synchronizing. Other than redoing the ordered relationships, this was their example!
I wasted months of development trying to get iCloud syncing working with Core Data years ago and this doesn't fill me with any sort of confidence to attempt this again.
Frustrated...
----------------------------------------------------------------------------------------
Update
----------------------------------------------------------------------------------------
I walked away for an hour and then decided to try the app again. All of the devices did sync back up and all of the objects appeared on each device. I do wish that there was someway to indicate through the gui that the sync is in process and whether there are errors being reported. I don't like the black box mentality but I am willing to give this another try. There is still hope.