I've been building an app with CKSyncEngine based off the documentation and sample code on GitHub. So far it's been working great, but I still have a number of questions I couldn't find the answer to I'd like to know before going into production. Here's a list in no particular order:
- When sending changes, are you expected to always send the entire record or just the fields that changed? It's not clear there would even be a way to know the fields that changed since when we have to populate the CKRecord from our local record, we only know the id.
- Likewise, when we get a record that changed on the server, do we always get a complete record even if only a single field changed?
- Related to that, if a record has asset(s), is the complete asset also returned on every server change even if we already have a copy locally and it hasn't been modified?
- If a record does have an asset, is the asset guaranteed to be downloaded and available at the asset.fileURL location by the time CKSyncEngine calls the delegate? If not, is there a way to know it's still downloading and when it will be available?
- Is there a way to lazy load assets to avoid unnecessary data fetching?
- If there is a failure during sync, for example if I fail to save just one record out of many, how do I recover from that? Is there a way to retry?
- Related, is there a way to verify we're completely in sync with the server?
- Is there any way to resync besides deleting the state serialization data and doing a complete sync again?
- Can I use CKSyncEngine from the main app and the app extensions if they share a database and state serialization. For example, when adding an image from the share extension. Any caveats to that?
Sorry for all the questions, but I want to make sure this is as efficient and reliable as possible. I'm going to request a Lab as well, but it's the lab request form isn't working at the moment so I figured I'd post here in case it's easier to answer async.
Thanks! – Zach