A fairly simple ModelContainer:
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Model1.self,
Model2.self,
Model3.self
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false, cloudKitDatabase: .automatic)
do {
let container = try ModelContainer(for: schema, migrationPlan: MigrationPlan.self, configurations: [modelConfiguration])
return container
} catch {
fatalError("Error: Could not create ModelContainer: \(error)")
}
}()
After upgrading to macOS 15 and disabling/enabling iCloud for the app the sync stopped working on Mac. The steps:
- Go to System Settings > Apple Account > iCloud > Saved to iCloud > See all
- find the App and disable iCloud. After this synced items are removed from the app and some errors thrown in the console ('..unable to initialize without an iCloud account...')
- Re-enable the iCloud setting
This error appears in the console:
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate resetAfterError:andKeepContainer:](612): <NSCloudKitMirroringDelegate: 0x6000020dc1e0> - resetting internal state after error: Error Domain=NSCocoaErrorDomain Code=134415 "(null)"
On macOS Sonoma the items are synced back to the app and the sync is restored, but on Sequoia they don't come back and the sync is not working. I tried resetting the container, deleting all data - no help.
Submitted FB15455847
The #3 error says that your app failed to connect to cloudd
because of a "Sandbox restriction", which indicates an entitlement issue, which ... doesn't make sense to me if the same thing works well on Sonoma (because that proves that the entitlements are correctly configured).
Would you mind to double check that, when the error occurs:
-
The iCloud on your device is on, as described in Configure iCloud on your devices
-
The CloudKit configuration in your app is correct, as described in Configure CloudKit in your project.
Also, I am wondering how you ran your app when testing the issue – Did you run the app with Xcode, or did you do it by double clicking a TestFlight version? In the latter case, was the app in the Applications
folder?
Best,
——
Ziqiao Chen
Worldwide Developer Relations.