@Engineer Thanks for sharing the sample project. It shows several examples how to use CloudKit, however, it doesn't include a Widget Extension or any references to WidgetKit. Is there another project that showcases this concrete use case, updating the same Core Data objects from both a Widget and an app?
@Jordan wrote in 2022:
Do note they also said NSPersistentCloudKitContainer does not support multi-process sync so only your app should be attempting to sync. And even if a widget were to attempt sync, it’ll never really be able to because iOS doesn’t give it enough time to execute, and widgets don’t run in the background they’re only running when they need to get more timeline entries for example, and widgets don’t get the app’s push notifications which is what enables background syncs to be scheduled. Your app will need to try to keep the widget up to date as opposed to the widget attempting to sync and keep itself up to date.
Is this (still) correct (in 2025)?
If so, then any attempt to update Core Data entities in a NSPersistentCloudKitContainer from the Widget itself would fail and in such a case, we would always have to find some workaround (like waking up the app from the widget), correct?
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: