Defaults
Defaults copied to clipboard
iCloud Settings Sync Issue: New App Installation Overwrites Existing Values with Empty Defaults
Problem Description
When creating settings that sync through iCloud, I encounter the following issue:
- Set some values in the app on Device A
- Install the app on Device B (new installation)
- The new app shows empty default values for the same settings
- These empty values overwrite the existing iCloud data
- All devices now show empty values instead of the original data
Expected Behavior
- Wait for iCloud sync to complete before initializing settings
- Load existing values from iCloud instead of using local defaults
- Not overwrite existing iCloud data with empty defaults
Are your values Equatable? This should already be handled for Equatable values: https://github.com/sindresorhus/Defaults/pull/185
For non-Equatable values, we still need a proper solution.
I think we could add this check: if both local and remote timestamps do not exist, we should abort the synchronization task. It should be suitable for resolving the new app initialization issue.
Yeah, makes sense 👍
@wyk111wyk Can you help try out 9.0.4: https://github.com/sindresorhus/Defaults/releases/tag/9.0.4