What is a good solution to synchronize data between iOS apps? [closed] What is a good solution to synchronize data between iOS apps? [closed] ios ios

What is a good solution to synchronize data between iOS apps? [closed]


If you want to do it yourself, this can be a very nice, yet challenging exercise. I don't know of any 3rd party frameworks that facilitate P2P connectivity between "iDevices", other than the ones below, from Apple. You can do some research along those lines if you don't want to re-invent the wheel. I am answering based on my (little) experience with implementing a syncing service via an app server - the principles must be more or less the same with a P2P approach.

The first step would be to design a protocol for syncing your data. Questions you might have to answer for yourself:

  • What do I need to understand about data synchronization?
  • Which part of my Core Data model do I want to sync? Should I make changes to my current model to facilitate syncing?
  • What serialization/deserialization mechanism will I use?
  • How will I be able to uniquely identify entities across multiple devices?
  • How will I version my data? How can I tell which entities need to be sync'ed?
  • Do I need to be able to revert a syncing operation?
  • How will I keep track of sync progress and how will I handle failures and exception cases? How will I notify the user of these?
  • Do I prefer to sync "incrementally" (parts of my model) or "globally" (the whole model at once)?
  • How often will the user need to sync between devices?
  • Are there any security considerations? Do I need encryption?
  • etc.

This is barely scratching the surface. You will definitely find more things to think about as you move forward.

Next, determine how you want to connect between devices. You seem to prefer an over-the-air solution, the P2P kind. For that, I would start by looking at these tools:

  • GameKit (this framework has APIs for establishing connectivity between devices over Bluetooth)
  • Bonjour (the Apple protocol for device discovery over a network - see the BonjourWeb sample application) + BSD sockets

Pick whichever tool(s) you feel most comfortable with and based on your design decisions discussed earlier. I can't help you there, as I don't have any experience with either of them. As Morpheus said:

I can only show you the door. You're the one that has to walk through it.

Sorry, little humor :)

Finally, decide on a solution to implement your syncing mechanism. You could e.g. choose a client-server model (one device will listen for a connection and another one will initiate it).

More relevant documentation:

I hope this gives you a starting path.


Syncing data is notoriously tricky. Simplistic solutions are worse than no solution.

For good spiritual guidance on the matter, go check out what the authors of Things are doing with their upcoming cloud sync functionality. My hope is that they will release a syncing API through which developers can implement syncing services. But even if they keep it to themselves, they're demonstrating quite nicely the sort of soul-searching required to really rise to the task.


"Couchbase for iOS" might address your need

https://github.com/couchbaselabs/iOS-Couchbase

According to the readme:

Mobile Couchbase for iOSApache CouchDB on iOS provides a simple way to sync your application

data across devices and provide cloud backup of user data. Unlike other cloud solutions, the data is hosted on the device by Couchbase Mobile, so even when the network is down or slow (airplane, subway, backyard) the application is responsive to users.

What this means for you:You can embed the rock solid distributed database, Mobile

Couchbase, on your iOS device. Your iOS apps can use Apache CouchDB's well-proven synchronization technology. If you <3 CouchApps, you can deploy them as iOS apps.