CKReference limit?

On the CKReference reference page it says :

https://developer.apple.com/reference/cloudkit/ckreference

Important

There is a hard limit to the number of references any one record can have. This limit is set to 750 references. Any attempt to exceed this limit will result in an error from the server.


Does this mean that a record can only have 750 references to it? Or does it mean a record can only store 750 references (to other records)?


An example....

Part of my schema looks like this:


Record type : Tag

name : String

items : CKReferenceList


Where "items" are references to other records relating to the tag. If this reference list stores more than 750 references, is that a problem? (I would think not)


On the inverse side, if each of my items has a reference back to the Tag record, and there are then 750 references back to the Tag record, is that a problem? ( I would think, yes)


Thanks for any help.

Replies

>Does this mean that a record can only have 750 references to it?


Yes, that.


>there are then 750 references back to the Tag record, is that a problem?


Yes, I think so - a reference is a reference. Use them wisely.

If the limit is an issue for you - you can always revert back to using strings to identify relations between objects (For example, store the record name as a string of the parent record as a property)


On the plus side:

- No max reference count

- No save-time limitation (you can upload these records in any order)


Negative effects:

- No delete rules, you have to throuroughly cleanup yourself after a delete

- Little bit of work

I just found this:

https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/PropertyMetrics/PropertyMetrics.html#//apple_ref/doc/uid/TP40015240-CH23-SW1


Maximum number of source references to a single target where the action is delete self = 750


And it seems like the limit is only applicable when having a delete rule set, otherwise you're fine.

Repeating a lot of information, i.e. adding referenses using recordName as a string should be avoidable as a common rule.

References are perhaps most important if you want to use CKShare and share all child records when sharing the parent.

The limit of 750 references does NOT apply to the parent/child references when using CKShare! But you can only share 5.000 CKRecords in total using a CKShare - otherwise, this undocumented limit will hit you