Hi all,
I’m encountering a consistent issue with SwiftData on watchOS when using CloudKit sync. After enabling:
let config = ModelConfiguration(schema: schema, cloudKitDatabase: .automatic)
…the app terminates ~30–60 seconds into a WKExtendedRuntimeSession. This happens specifically when:
Always-On Display is OFF
The iPhone is disconnected or in Airplane Mode
The app is running in a WKExtendedRuntimeSession (e.g., used for meditation tracking)
The Xcode logs show a warning:
Background Task ("CoreData: CloudKit Setup"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination.
It appears CloudKit sync setup is being triggered automatically and flagged by the system as an unmanaged long-running task, leading to termination.
Workaround:
Switching to:
let config = ModelConfiguration(schema: schema, cloudKitDatabase: .none)
…prevents the issue entirely — no background task warning, no crash.
Feedback ID submitted: FB17685611
Just wanted to check if others have seen this behavior or found alternative solutions. It seems like something Apple may need to address in SwiftData’s CloudKit handling on watchOS.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
watchOS
Background Tasks
SwiftData