You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automatically syncs NSUserDefaults across multiple iOS devices using iCloud key-value storage (NSUbiquitousKeyValueStore).
Installation
Drag all files into your Xcode project.
Requirements
iCloud requires iOS 5.0 or later. If iCloud is not available, this code does nothing.
Usage
All write and remove requests to NSUserDefaults are automatically synchronized with iCloud. To prevent synchronization for individual keys, prefix the key with a ! (exclamation mark).
To respond to updates from iCloud you can observe the FTiCloudSyncDidUpdateNotification. It contains the NSUserDefaults object and in the userInfo a dictionary with FTiCloudSyncChangedKeys and FTiCloudSyncRemovedKeys. These are arrays of the changed and removed keys.
Compatibility
FTiCloudSync is compatible with InAppSettingsKit, a framework to easily add in-app settings to iPhone apps. InAppSettingsKit automatically updates the UI when an iCloud update is received.
You are free to share, adapt and make commercial use of the work as long as you give attribution and keep this license. To give credit, we suggest this text in the about screen or App Store description: "Uses FTiCloudSync by Ortwin Gentz", with a link to the GitHub page.
If you need a different license without attribution requirement, please contact me and we can work something out.
If you would like to support my Open Source work, consider joining me as a sponsor! 💪️ Your sponsorship enables me to spend more time on this and other community projects. Thank you!
About
Automatically syncs NSUserDefaults across multiple iOS devices using iCloud.