In a CloudKit private database, the Owner creates a custom zone and performs the following actions:
- Creates CKRecord1 with CKShare1 and invites Participant1 to it.
- Creates CKRecord2 with CKShare2 and invites Participant2 to it.
- Creates CKRecordShared, which should be accessible to both Participant1 and Participant2.
How can I achieve step 3?
I observed that:
- Setting a regular reference from CKRecord1 (or CKRecord2) to CKRecordShared does not automatically make CKRecordShared accessible to Participant1 (or Participant2).
- CKRecordShared can only have one parent, so it cannot be directly linked via parent reference to both Participant1 and Participant2 at the same time.
One potential solution I see is to have the Owner create a separate CKShare for CKRecordShared and share it explicitly with each participant. However, this approach could lead to user errors, as it requires careful management of multiple shares for each participant.
Is there a better way to handle this scenario, ensuring that CKRecordShared is accessible to multiple participants without introducing unnecessary complexity or potential errors?
I observed that: Setting a regular reference from CKRecord1 (or CKRecord2) to CKRecordShared does not automatically make CKRecordShared accessible to Participant1 (or Participant2).
CKRecordShared can only have one parent, so it cannot be directly linked via parent reference to both Participant1 and Participant2 at the same time.
Yeah, the above behavior is as-designed.
One potential solution I see is to have the Owner create a separate CKShare for CKRecordShared and share it explicitly with each participant.
Yeah, this should work, assuming that CKRecordShared
is not a child or parent of CKRecord1
or CKRecord2
.
However, this approach could lead to user errors, as it requires careful management of multiple shares for each participant.
It is perfectly possible that a participant partipates multiple shares. That may add more complexity, but you app can implement appropriate UI for a participant (or owner) to manage the shared records.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.