Sync Private DB With iOS + macOS

I have created an iOS app and then added a macOS target in the same project.

Now I want both apps to share and sync data using a private database in CloudKit.


In Xcode's Capabilities page (for both targets) I specified to use a custom container ID.

=> iOS and macOS apps are pointing to the same iCloud container ID.

Then I verified in the developer portal that this iCloud container ID (and only this one ID) is set for both app IDs.


When I'm running the iOS app using my developer iCloud account, everything works fine, i can see the synced data in my CloudKit dashboard.


The problem is the macOS version. Somehow it's connected to a different container ID (the default one created by Xcode before I changed it to use the custom ID of the iOS app).


Can anyone tell me how to make both apps share the same iCloud container? I'm only interested in a private database, sharing with other users is not required.


Thanks

Accepted Reply

I don't do macOS but I'm guessing that the answer to your question might be some alteration of what is described here:


https://stackoverflow.com/questions/30458459/how-to-make-watchkit-extension-app-and-my-iphone-app-share-the-same-icloud-datab

Replies

I don't do macOS but I'm guessing that the answer to your question might be some alteration of what is described here:


https://stackoverflow.com/questions/30458459/how-to-make-watchkit-extension-app-and-my-iphone-app-share-the-same-icloud-datab

That solved my problem. Thanks for your help! 😃