How do I use CKSyncEngine?
Asked on 2024-07-30
1 search
To use CKSyncEngine, you can follow the steps outlined in the sessions from WWDC. Here are some relevant details:
-
Enable CloudKit in Your Project:
- Add iCloud to the signing and capabilities of your Xcode project.
- Turn on CloudKit under iCloud services and create a new container for syncing your data.
- Add background modes and enable the remote notifications capability to allow your app to process remote changes in the background.
-
Sync Data Across Devices:
- Use CloudKit to sync the display states for tips, ensuring that a user doesn't need to dismiss the same tip on multiple devices.
- Update your configuration to include the CloudKit container option and pass in your new container's ID.
-
Handle Data Conflicts:
- Implement a cloud save manager class to handle syncing, as demonstrated in the game porting project. This includes setting up your iCloud identifier and specifying an existing folder containing saved data.
- At game launch, call the sync method and pass a completion handler block to handle any merge conflicts between local data and cloud data.
- Save progress to the cloud by calling the upload method every time you write into save files, and use a completion handler to resolve conflicts.
For more detailed guidance, you can refer to the following sessions:
- Customize feature discovery with TipKit (10:48)
- Port advanced games to Apple platforms (18:53)
- Use CloudKit Console to monitor and optimize database activity (00:00)
These sessions provide comprehensive information on setting up and using CloudKit for syncing data across devices.

Customize feature discovery with TipKit
Focused on feature discovery, the TipKit framework makes it easy to display tips in your app. Now you can group tips so features are discovered in the ideal order, make tips reusable with custom tip identifiers, match the look and feel to your app, and sync tips using CloudKit. Learn how you can use the latest advances in TipKit to help people discover everything your app has to offer.

Use CloudKit Console to monitor and optimize database activity
Discover the new observability features in CloudKit Console. Learn how to use Telemetry and Logging to troubleshoot and optimize your app. Find out how to set up alerts to monitor your application’s behavior and notifications to stay on top of the container events that are most important to you. To get the most out of this session, we recommend being familiar with CloudKit containers.

Port advanced games to Apple platforms
Discover how simple it can be to reach players on Apple platforms worldwide. We’ll show you how to evaluate your Windows executable on Apple silicon, start your game port with code samples, convert your shader code to Metal, and bring your game to Mac, iPhone, and iPad. Explore enhanced Metal tools that understand HLSL shaders to validate, debug, and profile your ported shaders on Metal.
