Search code examples
iosicloudtvosapple-tvnsubiquitouskeyvaluestore

iCloud: Sync key-value-storage between iOS and tvOS


I have an app running on iOS and tvOS. I've set up settings sync using iCloud key-value storage:

  • iOS version synchronizes data using iCloud KVS. This working fine.
  • tvOS version synchronizes data using iCloud KVS. Also working fine.
  • However, I cannot get the iOS and tvOS versions to synchronize with each other.

I believe I have followed all the steps correctly:

  • Same app id, same bundle id.
  • Same iCloud account logged in on all devices.
  • The field com.apple.developer.ubiquity-kvstore-identifier in the entitlements is identical ($(TeamIdentifierPrefix)$(CFBundleIdentifier)).
  • Key name is identical
  • Both apps are syncing over the network (it's not just local cache).

Has anyone gotten cross-iOS/tvOS synchronization working? Is this even possible? Thank you for any advice.


Solution

  • Answering here for posterity: cross-sync was actually working correctly and the mistake was actually in how we handled serializing and deserializing of the value stored. We missed the exception until we looked deeper.