I have a SwiftData app that runs on iOS, iPadOS, and MacCatalyst and which uses CloudKit for inter-device sync. Unfortunately, I also have two AppleIDs (which I
'll refer to as OLDID and NEWID).
Although all three devices (phone, pad and desktop) are currently set up with NEWID as the active AppleID, during development and testing, my desktop Mac used OLDID. Apparently, the system remembers the AppleID to use with each CloudKit app (based on the AppleID active at time of first use), because the desktop app and the mobile apps apparently sync to different AppleID accounts.
I can delete the local database on the desktop and delete the local app on the mobile devices and in each case, reloading/rerunning the app causes the respective databases to be restored from the cloud. The two mobile devices sync with each other, but not with the desktop; the desktop doesn't sync with either device. And the two databases have decidedly different contents.
My goal is to consolidate everything so that there is one database, shared and synced between desktop, pad, phone and cloud.
I presume that there is a setting somewhere (but clearly NOT in the app's sandboxed container) that specifies what iCloud account to use for that (and each) app.
Note: I have other apps which sync between all my devices, so the setting must be on a per-app basis.
I also presume that if I changed it's value on my desktop (so that all three devices used the same AppleID for cloud services for my app), that the content of the local database on my desktop would be synced automatically to the NEWID cloud account and then (also automatically) synchronized with my mobile devices.
I.e., I speculate that I can solve all my problems by changing that setting on my desktop Mac.
So I have two questions:
- Is all this correct?
- How do I make this setting change. (I.e., where is it and how do I change it)
Does anyone have any experience and can help with this issue?
Thanks