iCloudStoreManager Notes - Updated June 16, 2012
INTRODUCTION
This standalone iOS project demonstrates using iCloud to sync a CoreData store between different iOS devices, what is often referred to as a Shoebox-style app. It must be run on an actual iOS device.
CHANGES
June 16, 2012
USING THE APP
To run the app you will first need to setup the iCloud entitlements. If you are not familiar with this, there is an excellent discussion here: http://oleb.net/blog/2011/11/ios5-tech-talk-michael-jurewitz-on-icloud-storage/
After installing the app on at least two devices. Generate a few lines of data by tapping the + symbol. Then tap the iCloud switch to ON. After anywhere from 10 seconds to 10 minutes you should see the second device's iCloud switch automatically switch ON, and the data on both devices should now be the same. Add new data, or delete data by swiping, on any device to observe how the data stays in sync. However, be prepared to see propagation delays that can be many minutes.
You can also try switching iCloud OFF and ON on either device to see how it can easily be switched between local data and iCloud data.
THE UX MODEL
The user experience model follows a very simple set of rules. An iCloud switch is required so that users can control from which device they seed iCloud. This is important because once an iCloud store is seeded with data, it should not be seeded again.
For test purposes ONLY, tapping the Clear iCloud Data button will delete all iCloud data from all devices (it may take many seconds or many minutes for this action to propagate to other devices). Each individual device will be automatically switched to using it's local data, and iCloud disabled within the app.
USING UbiquityStoreManager
The goal was to implement the simplest possible API. Apple's instructions on how to use Core Data with iCloud are deceivingly simple. Hopefully this class will make it truly simple and straightforward.
To implement this same functionality in your own app, all you need is UbiquityStoreManager.h and UbiquityStoreManager.m. There are roughly 7+ steps required in configuring and using UbiquityStoreManager. Search for STEP to find examples of all of the changes you will likely need to make it work in your own project.
This class includes alert messages to assist the user in making the appropriate choices when enabling or disabling iCloud.
The three most important methods are listed here:
However, using just these three methods is not sufficient for Core Data to function properly with iCloud. Please look at the source code to see all of the other methods and properties required.
TESTING AND KNOWN PROBLEMS
This has been tested out on an iPhone 4, iPhone 4S, original iPad, iPad 2, and the new iPad (3rd generation). Everything has been tested with up to five devices and works well in most cases. However, changes may sometimes take many minutes to propagate, leading you to think it's not working. But all of the devices will eventually sync up. Using iOS 5.1 is better than using iOS 5.0.
iCloudStoreManager is released under the New BSD License.
Copyright (c) 2012, Yodel Code LLC All rights reserved.