Since resetting or testing iCloud Key-Value Storage isn’t easy, I’d like to ask for your advice—since you probably know it well.
It is about how to properly use "OnSynchronizedCompleted".
Let’s assume the game data includes a "timestamp(long)" field that is frequently updated.
After the app launches, the first scene explicitly calls "Synchronize()", and in the "SynchronizeCompleted" callback, it compares the "timestamp" values of the Server Copy and the Local Copy.
My logic is as follows.
- Only if the Server Copy is newer, it overwrites the Local Copy with the Server Data.
- But if the Local Copy is newer, it does nothing—since it will be synced during the next periodic Synchronize() call anyway. (Of source, manually pushing local data to the server can be a good idea, but I just prefer to reduce the use of traffic)
In short, I wonder the above logic which comparing timestamps and conditionally overwriting data inside the "SynchronizeCompleted" callback is a good idea?
This is not so much a question as it's seeking your opinion. I'd appreciate any small feedback you can give. Thank you.