Skip to content

Automatically syncs NSUserDefaults across multiple iOS devices using iCloud.

Notifications You must be signed in to change notification settings

futuretap/FTiCloudSync

Repository files navigation

FTiCloudSync

License License Sponsor Mastodon

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.

Author

Developed by Ortwin Gentz (Mastodon) and used in FutureTap’s Where To? and Streets apps – we eat our own dog food!

License

Licensed under CC-BY-SA 3.0.

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.

Includes:

  • RegexKitLite by John Engelhart. Copyright © 2008-2010 John Engelhart. Licensed under the terms of the BSD License.
  • MethodSwizzling by Mike Ash

Sponsors wanted

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.

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published