Flaky Goodness

For the Most Part

March 29, 2013

iCloud has been getting piled on recently by the Mac and iOS developer community and that's too bad, because I think that for the most part1 it delivers on the promise of effortless, ubiquitous multi-device synchronization. There are bugs and edge cases to be sure, but it has been getting better2 and I believe that there is light at the end of the tunnel3. I may be naive, but I believe that most of iCloud4 either does or will soon "Just Work."

iCloud incorporates multiple sync technologies of which Core Data sync is just one. The promise of Core Data sync specifically is too great to ignore and it has lured many developers, including myself, into implementing solutions that depend on it. At some point or another, before, during, or (oh god the humanity) after release, iCloud Core Data sync falls out from under you and you must consider abandoning your project or using an alternative synchronization approach or even platform.

After my app was rejected for using (the dead simple and highly reliable) iCloud key-value store, I did in fact re-implement using Core Data sync. And I got it working, mostly. Then I hit one of those "falls out from under you" scenarios.

It has been suggested that iCloud Core Data is not appropriate for complex database schema with dependent relationships, integrity constraints, and so forth, but is quite useful for simple models. Based on my experience and the trivial example I put together to demonstrate my problem, I do not believe that to be the case.

But I could be wrong.

I've posted a 3-minute video that demonstrates the problem. It's possible that the bug is mine and mine alone, so here is the GitHub project if you'd like to take a look yourself. I would appreciate a pull request that actually resolves the errant behaviour rather than just works around it with a clever hack.

If this is a bonafide iCloud bug though, it's pretty bad. Given how trivially simple the use case is it's hard to imagine using iCloud Core Data sync in any shipping app5 until it improves. Here's the bug report, submitted to Apple as rdar://13192714.

As for my project, I've re-implemented (for the third time) using plain old text files in the plain old iCloud ubiquity store and have submitted it for review. It's working great: just as well as the original key-value store implementation. More on that soon.


1. Except for Core Data sync.

2. Core Data sync has not been getting better.

3. There is no light where there is Core Data sync.

4. Not the part with Core Data sync.

5. I know of some shipping iCloud Core Data apps, at least one of which is quite popular. I assume that their use cases manage to walk a very fine line between the issues others have and are continuing to report. There is no way to know whether any particular use case, no matter how simple, will be so blessed.