CloudKit integration requires does not support ordered relationships.

I'm trying to use Apple's CoreDataCloudkitDemo app. I've only changed the app settings per the README document. On running the demo, I'm getting the error: "CloudKit integration requires does not support ordered relationships."



The console log shows:


Fatal error: ###persistentContainer: Failed to load persistent stores:Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=CloudKit integration requires does not support ordered relationships. The following relationships are marked ordered:
Post: attachments


Does anyone have a workaround, or preferably, a fix? Or did I do something wrong?


Thanks

Post not yet marked as solved Up vote post of davidd Down vote post of davidd
4.1k views

Replies

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.

I was having the same issue in Xcode 11 Beta 4. I deleted the entitlements file and that seemed to work.

Same original question.


Clarification:

This session: https://developer.apple.com/videos/play/wwdc2019/202

This sample code: https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud


Using the Sample Code— if clicking the "ordered" UI checkbox in XCode's Core Data model editor / Entities / Relationship Inspector ... "breaks" the thing ... how can I circumvent this sharp edge through code to ensure the Lamport Clock / timestamp method is safely / appropriately concatonated?


Prefereably an answer that doesn't involve stripping the code apart, or removing it's entitlements.

I also solved the problem by uncheck the ordered attribute from within the core data model editor, then alter several files to support the change from NSOderedSet to NSSet, it just works!


And I watched the WWDC19 Session 202 again, I found the demo shows they did not set both attachments and tags relationships as Ordered, so I think there's something wrong in the given demo project.

I submitted a bug report about the problem (FB6902557):


The example project for NSPersistentCloudKitContainer

https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud

doesn't work out of the box on Beta 5.


Just downlading and running it causes an runtime error:


CloudKit integration requires does not support ordered relationships. The following relationships are marked ordered:
Post: attachments
Post: tags


Also, the iCloud container ID is currently dependent on the bundle ID and the project has Catalyst enabled which leads to a Automatic signing error because of the different ids.


I worked around these issues to make the project work, see:

https://github.com/ralfebert/SynchronizingALocalStoreToTheCloud

https://github.com/ralfebert/SynchronizingALocalStoreToTheCloud/commit/e836893f5a669390090638d89a4f19021e1d2b11

https://github.com/ralfebert/SynchronizingALocalStoreToTheCloud/commit/c6306c30864422c2f6cb0cecb56c2b2374e5e6e0


The issue is also discussed here:

https://stackoverflow.com/questions/57089435/is-there-a-way-to-resolve-this-error-cloudkit-integration-requires-does-not-su

Does the original sample code included methods to handle Lamport timestamp, for the entity PostContent, shown in the last slide before the summary?

It would be cool to see how CRDTs were implemented. Updated sample code does not mention any Lamport clock, neither ralf.ebert's GitHub repo.