Solutions for iOS collaborative sync (iCloud CoreData, CouchDB)

collaborationcouchdbiossynchronization

I'm developing an iOS app where one of the features will be allowing users to share and collaborate on data (e.g. lists). From everything I've read and based on the way that iCloud CoreData sync works I assume that it would not be a good fit for the following reasons, but I wanted to make sure I wasn't missing anything, as I'd prefer not to use a 3rd party syncing solution if at all possible:

  • iCloud sync of any kind (CoreData, Document or Key / Value pairs) can only ever be between devices that use the same iCloud account, so it's designed for a single user syncing data over multiple devices. Any kind of collaborative sync (several people editing the same document / list) simultaneously would be limited to everyone have the same iCloud account. Cases of people sharing the same iCloud account is usually limited to, for example, husband and wife or similar close relationships for a small number of people.

  • iCloud Core Data sync is for ensuring that each sync'd device has the same data. It doesn't seem to allow syncing just a subset of the data, so scenarios in which each user has their own documents and is only sharing / collaborating on a subset of them are not supported.

And I'm not even mentioning the well document problems with iCloud CoreData syncing which may or may not have been resolved with iOS 7.

Given the above, it would seem that CouchDB (with TouchDB) would be a better option, as it seems to support everything I need. What other options are there that people can recommend?

UPDATE: Since posting this I've done more research and discovered that CouchDB as it stands would not be a good solution. Its filtered replication feature seems like it was made for syncing only a subset of data (e.g. data for one user) to a mobile device from a central server database that has all users' data on it. However, it's not a workable solution for both performance and security reasons. The guys at Couchbase are working on solutions for this, but they are all in early alpha stages.

For a solution that doesn't involve creating your own backend, the options seem to boil down to Simperium, Parse or something like Windows Azure mobile services. Of these, the only one that supports real time push sync (no need to refresh or poll for new data) seems to be Simperium. The one downside to Simperium is that it doesn't support binary data (eg images).

Best Answer

You probably don't really want or need to share all of the internal app data into the cloud. I recommend you take a look at CloudKit. You can save your binary assets that need to be shared between all users by placing the information into the public CloudKit database.

For getting started with CloudKit check out this full tutorial. Now the basics are covered here but how you use them most efficiently is not. You may want to consider only downloading assets when they are needed. To accomplish this it might be useful to create a table referencing the share status for owners of other records along with users who have access to those records (including an option for sharing to public ~ other app users).

You could then simply post a local alert to a user when new data is available and allow them to control the download (using a fetched count of new share records available to a user and then using a local notification). Or you might want to process downloads only in the background mode. This all depends on your use case, but you will want to think about when to make the action happen as that might cause unnecessary issues with user bandwidth. Maybe only download over wifi, etc...