I found out part of my problem involving
CloudKit, SwiftData and multiple AppleIDs.
It turns out that there is a setting in the Mac version of the AppStore app, called "Sandbox Account".
(This setting is not available on the Mobile versions of the AppStore app.) It appears that this setting is used to determine what AppleID is associated with an app when it is downloaded.
In my case, this setting was set to my old AppleID.
So when I loaded my app from the AppStore, it was associated with my old AppleID, which meant that CloudKit stored its synced data is my old AppleID's account. On the mobile side, this setting doesn't exist, so it appears that the AppStore uses the CURRENT AppleID. So my app was associated with one AppleID on the Macintosh and another AppleID on mobile devices. Hence incompatible data and no syncing.
Changing this setting on Macintosh and reloading fixes synching, but leaves me with a different problem —
before starting all this testing, I saved the SwiftData database from the Mac, which contained a bunch of information I want to retain.
I tried simply moving the database files into the Mac app's Application Support directory (in its sandboxed container). This resulted in being able to see and work with the data on the Mac, but it DID NOT SYNC.
Does anybody have any ideas of how to get this data out of the saved database and into the new (fully synced) database so that it is available on all of my devices? (Needless to say, I'm looking for something other than manually retyping all of the data.)
Any thoughts would be appreciated.
Topic:
App & System Services
SubTopic:
SwiftData
Tags: