Learn how to integrate your app with iCloud for effective data storage.

Documentation

Posts under iCloud subtopic

Post

Replies

Boosts

Views

Activity

How can I reliably refresh WidgetKit widgets across devices after SwiftData + CloudKit synchronization?
Hey, I'm building an app that uses App Intents to modify data stored in SwiftData and synced through CloudKit. My expectation is that these changes should eventually be reflected in my app's widgets across all of the user's devices (iPhone, iPad, and Mac). However, I'm struggling to find a reliable way to ensure widgets reload when the underlying data changes as a result of a CloudKit sync. Reloading widgets on the device that modifies the data works reliably. The challenge is ensuring widgets reload on other devices after the updated data has been synced through CloudKit. In practice, this doesn't appear to happen reliably. I do not expect the user to manually open the app on those devices. I'm fine with the system launching my app in the background if that's part of the intended solution. Is there a recommended approach for keeping widgets in sync with SwiftData and CloudKit across devices? More specifically: Can WidgetKit be notified when SwiftData receives updates from CloudKit? Is there any supported way to trigger widget reloads on remote devices after a CloudKit sync? If not, what is the recommended architecture for ensuring widgets stay reasonably up to date when synchronized data changes? Things I've considered and/or tried: Calling sendChanges(_:) on CKSyncEngine from my App Intent to push changes immediately. However, this depends on an active Internet connection and doesn't address the case where changes are made offline and synchronized to CloudKit at a later time. Sending push notifications to the user's devices after an App Intent runs and using WidgetPushHandler to reload widgets. However, this requires confidence that the changes have already been uploaded to CloudKit. As far as I can tell, that's difficult or impossible to guarantee in the general case because of the issue described above. Calling fetchChanges(_:) on CKSyncEngine from the widget's timeline provider to ensure the widget has the latest data. However, the widget first needs some indication that new changes are available in CloudKit. Additionally, widget timeline reloads appear to have fairly strict execution time limits, which makes performing CloudKit synchronization work in that context seem less than ideal. My goal is for a Shortcut run on one device to update data and have widgets on all of the user's devices reflect those changes without requiring the user to manually open the app on each device. Am I thinking about this problem correctly, or is there a recommended pattern I'm missing? I'd appreciate any guidance on the intended WidgetKit + SwiftData + CloudKit integration story for this scenario. Thanks!
4
3
181
1h
iOS Feature Proposal: iCloud KeySync
iCloud KeySyc is a privacy-focused feature that securely syncs a user’s personalized keyboard learning across all Apple devices through iCloud. Today, when users upgrade to a new iPhone or begin using a new iPad or Mac, the keyboard often loses much of the personalization it has developed over time. Users must re-teach autocorrect, rebuild custom vocabulary, and wait for the keyboard to relearn their typing habits. iCloud KeySync would allow users to move seamlessly between devices while keeping the keyboard experience familiar from day one. Problem Statement Apple’s keyboard becomes more useful over time as it learns: Frequently used words and phrases Personal slang and abbreviations Emoji preferences Autocorrect adjustments Writing patterns and typing habits When users switch devices, much of this personalization is lost or takes time to rebuild. This creates friction during device upgrades and reduces the feeling of continuity within the Apple ecosystem. Proposed Solution iCloud KeySync securely synchronizes keyboard personalization data across Apple devices. The feature would: Learn and store personalized keyboard behavior on-device. Encrypt and sync personalization data through iCloud. Restore keyboard preferences automatically when signing into a new device. Keep keyboard learning consistent across iPhone, iPad, and Mac. Key Features Personalized Vocabulary Sync Synchronizes user-added words, nicknames, slang, and frequently used phrases. Emoji Preference Sync Maintains commonly used emoji patterns across devices. Autocorrect Learning Sync Preserves learned corrections and accepted custom spellings. Typing Behavior Continuity Allows devices to share keyboard learning so users receive familiar suggestions regardless of which Apple device they use. User Controls Enable or disable iCloud KeySync. Reset keyboard learning at any time. View privacy information and storage usage. Privacy and Security Privacy should remain the foundation of the feature. All keyboard learning occurs on-device. Personalization data is end-to-end encrypted. Raw message content is never uploaded. Users retain full control over synchronization settings. Security protections match the standards used by iCloud Keychain. User Benefits New devices feel familiar immediately. Less time correcting autocorrect mistakes. Faster onboarding after device upgrades. Consistent typing experience across the Apple ecosystem. Improved customer satisfaction and retention. Example User Scenario A user upgrades from an older iPhone to a new iPhone. After signing into iCloud and restoring their device, the keyboard immediately recognizes their commonly used phrases, preferred emoji, custom words, and learned typing patterns. The new device feels personalized from the first message typed, without requiring weeks of retraining Business Value Improves the upgrade experience. Strengthens ecosystem continuity. Reinforces Apple’s privacy-first approach to AI and machine learning. Creates a subtle but meaningful quality-of-life improvement for millions of users. Switch phones. Keep your vibe.
1
0
39
1d
CKSyncEngine doesn't send changes until app restarts
I've noticed that new record saves added using add(pendingRecordZoneChanges:) while handling events such as sentRecordZoneChanges or fetchedRecordZoneChanges aren't processed by CKSyncEngine until the app restarts, i.e. the app process has to be terminated and started again for CKSyncEngine to actually attempt to send the pending record saves. This started happening ever since I updated iOS and macOS to 26.5. Is this by design or a bug I should report?
1
0
77
2d
Display state of iCloud files
I’m building a macOS app that displays a large grid of image thumbnails similar to Photos. What is the recommended way to determine whether a file is locally available/downloaded without making a blocking call to the filesystem for every thumbnail? Thanks!
5
1
150
3d
App Privacy Report says app connecting to Google for CKDatabase
I have a CloudKit container that I share across several apps. when I look at the App Privacy Report for these apps, it reflects the app connecting to Google storage APIs. While Apple might host with Google, the perception for users is iCloud and Apple. Can something be done about this? FB16410232 (CloudKit: CloudKit requests contacting google upload servers unexpectedly in app privacy report)
1
0
76
3d
CloudKit client usage should be attributed to app for MetricKit network metrics
In the past I ran into issues where the CloudKit client SDK was not attributing network usage in MetricKit. Since MetricKit got a major update this year I’d like to make sure usage goes here agains the app. I would expect transfer metrics to also count for CKSyncEngine, or the CloudKit config for core/swift data too. Is this assumption correct? FB12673917 (CloudKit / MetricKit: CloudKit queries are not counting towards network transfer metrics in MetricKit - WWDC23 lab, possible missing URLSession 'attributedBundleIdentifier' not being set)
1
0
57
3d
Recommended way to display user-friendly iCloud Drive paths?
I’m building a macOS app that stores file URLs/bookmarks and displays file locations in the UI. For files in iCloud Drive, I want to show a user-friendly path such as: iCloud Drive / My Folder / File.jpg rather than an internal filesystem path. What is the recommended way to display iCloud Drive paths in a way that matches what users see in Finder? Thanks!
1
0
71
3d
Add Analytics Reports for CloudKit usage
I don’t have a feedback for this yet, but I’d like to see some analytics reports for CloudKit performance. Things to capture stats, performance, failures, etc. lots of the data in the console, but exposed through analytics reports. Related but different, if I had something like a generated OpenAPI client, I’d add instrumentation via client middleware. I could do most of what I’d want to instrument that way, status codes, timeouts, durations, payload sizes, etc. Alternatively, if the CloudKit client API exposed URLSession, or a hook to the delegate / metrics, a lot of what I am interested in could be achieved via session task metrics too. FB13628463 (CloudKit: Expose URLSessionTaskMetrics from CloudKit client)
1
0
51
3d
CloudKit security roles
I’d like the ability to detect a users security role. This makes sense for detecting the roles assigned to named users for enabling workflows within an app. For example, user generated content and “moderators”. Instead of building an unlisted app, I’d prefer to just check permissions against the user. As a workaround, one could create record types with the same “security role” as the moderator actions, but to attempt to fetch a dummy record seems fragile and inefficient. FB9638492 (CloudKit: API to detect provided security role on current user)
1
0
47
3d
CloudKit container may need indexing
My queries are failing in an unusual way. I can query 4 out of 5 Record Types. The 5th fails from the app (CKQueryOperation) and, surprisingly, also from the CloudKit Dashboard. It returns only 100-300 records when it should return over 4000. Tapping "Query Records" returns an additional 100-300 records. Apple Developer Technical Support has suggested that the issue involves the index of the container and wrote that only the CloudKit Team can fix it. So my question is - How do I get the CloudKit Team to fix it????
3
0
120
3d
NSPersistentCloudKitContainer doesn't report "Quota Exceeded" through notification
When subscribing to NSPersistentCloudKitContainer.eventChangedNotification events, quota exceeded events aren't delivered to the app at runtime. I get CKError.partialFailure, but without any additional information in any of the properties. https://developer.apple.com/documentation/cloudkit/ckerror/code/partialfailure states information should be available, but it isn't. When a debugger is attached, the information is logged by another process, but my app cannot access that at runtime to provide users with additional information. Is there any workaround to get this to work? References: Older post: https://forums.developer.apple.com/forums/thread/696523 FB13773922
4
0
150
3d
Question on PCS Zone corruption recovery
Hi all - figured I would kick off with a CloudKit question. Recently in development of a multi-device app I got into a state where all iOS devices could not write to the (production) CloudKit container - however macOS could still write (multi-device SwiftUI code). After ruling out a lot of other things it seemed like there had been some corruption in the production zone's PCS key chain. The only fix was deleting the zone from the CloudKit Console (safe for my pre-release beta data, but destructive). Is there a safer or developer-accessible recovery path for PCS chain corruption? Is this situation detectable earlier, or is there guidance on avoiding it during pre-release testing? The error in the logs in this scenario had "overallStatus":"USER_ERROR", "error":"BAD_REQUEST", "returnedRecordTypes":"_pcs_data".
1
0
97
3d
CKSyncEngine for records with references
Is there any guidance for syncing records that have references to others regarding batching with the sync engine? For example, if I have hundreds of records to sync with many different types and references, do I need to keep track of how many records would be added because of reference properties? The sample and video doesn’t go into details about syncing records that have references to others so looking for lesser known rough edges.
1
0
61
3d
CloudKit with Swift on Server or Mac dev tools
What recommendation would you have for teams wanting to build a CloudKit integration in the cloud? For example, the backend writes data to the public database, users read it, controlled via security roles. CloudKit Web Services documentation has been archived for some time but the services still exist. Generating a client using Swift OpenAPI generator would be real slick. The same could be used in local tooling that has the server API key.
1
1
77
3d
How can I reliably refresh WidgetKit widgets across devices after SwiftData + CloudKit synchronization?
Hey, I'm building an app that uses App Intents to modify data stored in SwiftData and synced through CloudKit. My expectation is that these changes should eventually be reflected in my app's widgets across all of the user's devices (iPhone, iPad, and Mac). However, I'm struggling to find a reliable way to ensure widgets reload when the underlying data changes as a result of a CloudKit sync. Reloading widgets on the device that modifies the data works reliably. The challenge is ensuring widgets reload on other devices after the updated data has been synced through CloudKit. In practice, this doesn't appear to happen reliably. I do not expect the user to manually open the app on those devices. I'm fine with the system launching my app in the background if that's part of the intended solution. Is there a recommended approach for keeping widgets in sync with SwiftData and CloudKit across devices? More specifically: Can WidgetKit be notified when SwiftData receives updates from CloudKit? Is there any supported way to trigger widget reloads on remote devices after a CloudKit sync? If not, what is the recommended architecture for ensuring widgets stay reasonably up to date when synchronized data changes? Things I've considered and/or tried: Calling sendChanges(_:) on CKSyncEngine from my App Intent to push changes immediately. However, this depends on an active Internet connection and doesn't address the case where changes are made offline and synchronized to CloudKit at a later time. Sending push notifications to the user's devices after an App Intent runs and using WidgetPushHandler to reload widgets. However, this requires confidence that the changes have already been uploaded to CloudKit. As far as I can tell, that's difficult or impossible to guarantee in the general case because of the issue described above. Calling fetchChanges(_:) on CKSyncEngine from the widget's timeline provider to ensure the widget has the latest data. However, the widget first needs some indication that new changes are available in CloudKit. Additionally, widget timeline reloads appear to have fairly strict execution time limits, which makes performing CloudKit synchronization work in that context seem less than ideal. My goal is for a Shortcut run on one device to update data and have widgets on all of the user's devices reflect those changes without requiring the user to manually open the app on each device. Am I thinking about this problem correctly, or is there a recommended pattern I'm missing? I'd appreciate any guidance on the intended WidgetKit + SwiftData + CloudKit integration story for this scenario. Thanks!
Replies
4
Boosts
3
Views
181
Activity
1h
Making all in My device developer work perfectly
Don’t spam
Replies
0
Boosts
0
Views
17
Activity
15h
iOS Feature Proposal: iCloud KeySync
iCloud KeySyc is a privacy-focused feature that securely syncs a user’s personalized keyboard learning across all Apple devices through iCloud. Today, when users upgrade to a new iPhone or begin using a new iPad or Mac, the keyboard often loses much of the personalization it has developed over time. Users must re-teach autocorrect, rebuild custom vocabulary, and wait for the keyboard to relearn their typing habits. iCloud KeySync would allow users to move seamlessly between devices while keeping the keyboard experience familiar from day one. Problem Statement Apple’s keyboard becomes more useful over time as it learns: Frequently used words and phrases Personal slang and abbreviations Emoji preferences Autocorrect adjustments Writing patterns and typing habits When users switch devices, much of this personalization is lost or takes time to rebuild. This creates friction during device upgrades and reduces the feeling of continuity within the Apple ecosystem. Proposed Solution iCloud KeySync securely synchronizes keyboard personalization data across Apple devices. The feature would: Learn and store personalized keyboard behavior on-device. Encrypt and sync personalization data through iCloud. Restore keyboard preferences automatically when signing into a new device. Keep keyboard learning consistent across iPhone, iPad, and Mac. Key Features Personalized Vocabulary Sync Synchronizes user-added words, nicknames, slang, and frequently used phrases. Emoji Preference Sync Maintains commonly used emoji patterns across devices. Autocorrect Learning Sync Preserves learned corrections and accepted custom spellings. Typing Behavior Continuity Allows devices to share keyboard learning so users receive familiar suggestions regardless of which Apple device they use. User Controls Enable or disable iCloud KeySync. Reset keyboard learning at any time. View privacy information and storage usage. Privacy and Security Privacy should remain the foundation of the feature. All keyboard learning occurs on-device. Personalization data is end-to-end encrypted. Raw message content is never uploaded. Users retain full control over synchronization settings. Security protections match the standards used by iCloud Keychain. User Benefits New devices feel familiar immediately. Less time correcting autocorrect mistakes. Faster onboarding after device upgrades. Consistent typing experience across the Apple ecosystem. Improved customer satisfaction and retention. Example User Scenario A user upgrades from an older iPhone to a new iPhone. After signing into iCloud and restoring their device, the keyboard immediately recognizes their commonly used phrases, preferred emoji, custom words, and learned typing patterns. The new device feels personalized from the first message typed, without requiring weeks of retraining Business Value Improves the upgrade experience. Strengthens ecosystem continuity. Reinforces Apple’s privacy-first approach to AI and machine learning. Creates a subtle but meaningful quality-of-life improvement for millions of users. Switch phones. Keep your vibe.
Replies
1
Boosts
0
Views
39
Activity
1d
Consistent login issues in Cloudkit console "Act as iCloud Account"
I have been having this weird issue. Whenever I tap on "Act as iCloud Account" in cloudkit console, my login never works. I have been having this issue for more than 6 months now. ANy one have any insights on this?
Replies
0
Boosts
0
Views
14
Activity
1d
CKSyncEngine doesn't send changes until app restarts
I've noticed that new record saves added using add(pendingRecordZoneChanges:) while handling events such as sentRecordZoneChanges or fetchedRecordZoneChanges aren't processed by CKSyncEngine until the app restarts, i.e. the app process has to be terminated and started again for CKSyncEngine to actually attempt to send the pending record saves. This started happening ever since I updated iOS and macOS to 26.5. Is this by design or a bug I should report?
Replies
1
Boosts
0
Views
77
Activity
2d
Display state of iCloud files
I’m building a macOS app that displays a large grid of image thumbnails similar to Photos. What is the recommended way to determine whether a file is locally available/downloaded without making a blocking call to the filesystem for every thumbnail? Thanks!
Replies
5
Boosts
1
Views
150
Activity
3d
App Privacy Report says app connecting to Google for CKDatabase
I have a CloudKit container that I share across several apps. when I look at the App Privacy Report for these apps, it reflects the app connecting to Google storage APIs. While Apple might host with Google, the perception for users is iCloud and Apple. Can something be done about this? FB16410232 (CloudKit: CloudKit requests contacting google upload servers unexpectedly in app privacy report)
Replies
1
Boosts
0
Views
76
Activity
3d
CloudKit client usage should be attributed to app for MetricKit network metrics
In the past I ran into issues where the CloudKit client SDK was not attributing network usage in MetricKit. Since MetricKit got a major update this year I’d like to make sure usage goes here agains the app. I would expect transfer metrics to also count for CKSyncEngine, or the CloudKit config for core/swift data too. Is this assumption correct? FB12673917 (CloudKit / MetricKit: CloudKit queries are not counting towards network transfer metrics in MetricKit - WWDC23 lab, possible missing URLSession 'attributedBundleIdentifier' not being set)
Replies
1
Boosts
0
Views
57
Activity
3d
Recommended way to display user-friendly iCloud Drive paths?
I’m building a macOS app that stores file URLs/bookmarks and displays file locations in the UI. For files in iCloud Drive, I want to show a user-friendly path such as: iCloud Drive / My Folder / File.jpg rather than an internal filesystem path. What is the recommended way to display iCloud Drive paths in a way that matches what users see in Finder? Thanks!
Replies
1
Boosts
0
Views
71
Activity
3d
Add Analytics Reports for CloudKit usage
I don’t have a feedback for this yet, but I’d like to see some analytics reports for CloudKit performance. Things to capture stats, performance, failures, etc. lots of the data in the console, but exposed through analytics reports. Related but different, if I had something like a generated OpenAPI client, I’d add instrumentation via client middleware. I could do most of what I’d want to instrument that way, status codes, timeouts, durations, payload sizes, etc. Alternatively, if the CloudKit client API exposed URLSession, or a hook to the delegate / metrics, a lot of what I am interested in could be achieved via session task metrics too. FB13628463 (CloudKit: Expose URLSessionTaskMetrics from CloudKit client)
Replies
1
Boosts
0
Views
51
Activity
3d
Control Logging of CloudKit in Xcode
I often struggle to see my own log data with the heavy stream of CloudKit updates. Is there an easy way to filter that our or turn it on/off?
Replies
3
Boosts
0
Views
98
Activity
3d
CloudKit security roles
I’d like the ability to detect a users security role. This makes sense for detecting the roles assigned to named users for enabling workflows within an app. For example, user generated content and “moderators”. Instead of building an unlisted app, I’d prefer to just check permissions against the user. As a workaround, one could create record types with the same “security role” as the moderator actions, but to attempt to fetch a dummy record seems fragile and inefficient. FB9638492 (CloudKit: API to detect provided security role on current user)
Replies
1
Boosts
0
Views
47
Activity
3d
CloudKit container may need indexing
My queries are failing in an unusual way. I can query 4 out of 5 Record Types. The 5th fails from the app (CKQueryOperation) and, surprisingly, also from the CloudKit Dashboard. It returns only 100-300 records when it should return over 4000. Tapping "Query Records" returns an additional 100-300 records. Apple Developer Technical Support has suggested that the issue involves the index of the container and wrote that only the CloudKit Team can fix it. So my question is - How do I get the CloudKit Team to fix it????
Replies
3
Boosts
0
Views
120
Activity
3d
Notification when iCloud Drive state changes
Is there any way to get notified in macOS when the iCloud Drive becomes online/offline so that I can update the UI in my app to reflect that state? Thanks!
Replies
1
Boosts
0
Views
85
Activity
3d
Cloudkit sharing available in swift instead Core Kit
Hi there, as far as I know CloudKit sharing is only available when using Core Kit coding instead swift. Are you okaying to open that posibility in further versions of swift?
Replies
6
Boosts
0
Views
148
Activity
3d
NSPersistentCloudKitContainer doesn't report "Quota Exceeded" through notification
When subscribing to NSPersistentCloudKitContainer.eventChangedNotification events, quota exceeded events aren't delivered to the app at runtime. I get CKError.partialFailure, but without any additional information in any of the properties. https://developer.apple.com/documentation/cloudkit/ckerror/code/partialfailure states information should be available, but it isn't. When a debugger is attached, the information is logged by another process, but my app cannot access that at runtime to provide users with additional information. Is there any workaround to get this to work? References: Older post: https://forums.developer.apple.com/forums/thread/696523 FB13773922
Replies
4
Boosts
0
Views
150
Activity
3d
Question on PCS Zone corruption recovery
Hi all - figured I would kick off with a CloudKit question. Recently in development of a multi-device app I got into a state where all iOS devices could not write to the (production) CloudKit container - however macOS could still write (multi-device SwiftUI code). After ruling out a lot of other things it seemed like there had been some corruption in the production zone's PCS key chain. The only fix was deleting the zone from the CloudKit Console (safe for my pre-release beta data, but destructive). Is there a safer or developer-accessible recovery path for PCS chain corruption? Is this situation detectable earlier, or is there guidance on avoiding it during pre-release testing? The error in the logs in this scenario had "overallStatus":"USER_ERROR", "error":"BAD_REQUEST", "returnedRecordTypes":"_pcs_data".
Replies
1
Boosts
0
Views
97
Activity
3d
CKSyncEngine for records with references
Is there any guidance for syncing records that have references to others regarding batching with the sync engine? For example, if I have hundreds of records to sync with many different types and references, do I need to keep track of how many records would be added because of reference properties? The sample and video doesn’t go into details about syncing records that have references to others so looking for lesser known rough edges.
Replies
1
Boosts
0
Views
61
Activity
3d
CloudKit with Swift on Server or Mac dev tools
What recommendation would you have for teams wanting to build a CloudKit integration in the cloud? For example, the backend writes data to the public database, users read it, controlled via security roles. CloudKit Web Services documentation has been archived for some time but the services still exist. Generating a client using Swift OpenAPI generator would be real slick. The same could be used in local tooling that has the server API key.
Replies
1
Boosts
1
Views
77
Activity
3d
Strategy for Limiting CloudKit Activity / Refreshing
Are there good ways to guide an app to pause iCloud syncing if the app is busy with an intensive activity? Also, is there a way to suggest that it check iCloud for updates?
Replies
1
Boosts
0
Views
78
Activity
3d