CKShare fails reproducibly for a large number of child records

Another day, another CloudKit issue :-)


Maybe someone else has encountered this:


Sharing a root record with 5.000 or more child records fails with a "Server rejected request" error:


<CKError 0x600001c54ee0: "Server Rejected Request" (15/2000); server message = "Internal server error"; uuid = 915943EA-2816-426A-93E7-C3B197DA4C95; container ID = "iCloud.com.syniumsoftware.macfamilytree8">


If the root record of the CKShare contains less objects, it works perfectly OR if the CKShare was already present before the 5.000 objects have been created.


We've already filed a bug report for this: #28473396

Replies

Got an answer from Apple developer technical support that they could reproduce the issue and they've asked the CloudKit team if there is anything they can do about it.


Strangely, if the CKShare is created before the other records are inserted, everything is fine and all records (even 100k or much more!) can be shared using the CKShare without any problems or performance issues. Creating the CKShare after inserts (as suggested by the documentation) fails.


Example:


Create a root record to use as a parent for records

Create 5.000 Records

Create CKShare with root record

-> FAILS with "Server Rejected Request"


Create a root record to use as a parent for records

Create CKShare with root record

Create 5.000 Records

-> WORKS

Hi MedelK,

How did you go with this issue? any updates? I am currently thinking about working on same thing using similar methods. Share root CKRecord with many child CKRecord. What kind of setup do you have? Root record contains all child records or each child records has a reference to root record?


What I really want to ask is. If it's root record contains child records, when a child record is updated (added, modified, deleted), will root record be considered as modified as well? which means when downloading updates from iCloud, it basically sends all child records over the network instead of changed ones. It doesn't feel optimal unless I am wrong.


If child record keep a reference to root record, will child records be shared automatically when root record is shared?

>If it's root record contains child records, when a child record is updated (added, modified, deleted), will root record be considered as modified as well?


No, the root record will not be modified in this case and you will not receive an update for it. However, please note that the parent's change tag might actually get a new value because of that (it is a bug in CloudKit):

https://forums.developer.apple.com/message/169594#169594


>If child record keep a reference to root record, will child records be shared automatically when root record is shared?


Yes, they will be shared automatically.