With GameFriends in the app store queue, it’s time to start on v2.0, the main feature of which is iCloud support.
The app was written to use Core Data in a “library style” where there is a single object store for the entire app. iCloud supports this type of application by storing the updates logs in iCloud. Each instance of the app then updates its local store using the logs that iCloud propagates.
This turns out to be extremely simple to implement; an Apple engineer even did an awesome job of updating the Recipes sample app to work this way.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Then you register for notifications for updates when you create the context:
1 2 | |
The final bit is to respond to the notification by merging the changes from the logs into the context, kind of like this:
1 2 | |
Unfortunately, it seems like it doesn’t quite work reliably, yet. After using the app for a bit the logs get out of sync and no more updates propagate. Bummer.
So I’m having to refactor the app to use UIDocument instances. These seem to be rock solid & fast. It’s just more work than I anticipated since Core Data give you a lot of extra goodies you’ve got implement yourself with out it.
Ah well …

