I am able to share a record in CloudKit using the instructions in the Apple Documentation, including the CloudKitShare sample, but when another user accepts the share, only the root record is saved in the sharedDatabase. There is supposed to be another record that has a reference to the root record.
I'm not sure what code to include in this post. Perhaps someone can tell me that much or know of a common programmer mistake that causes this error.
Here is the basic code, after I have removed code not essential to the problem, to make my code easier to read.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {
let container = CKContainer(identifier: cloudKitShareMetadata.containerIdentifier)
let acceptSharesOperation = CKAcceptSharesOperation(shareMetadatas: [cloudKitShareMetadata])
container.add(acceptSharesOperation)
}
}