Search code examples
iphonecocoa-touchcocoadata-synchronization

iPhone offline application with synchronization


I'm looking into building an application which works just as well offline as it does online. Since the application cannot communicate with the server while in offline, there is some level of synchronization which needs to take place.

What are some good tools to read about and start thinking about when planning offline operations with synchronization for your iPhone?

What tools would I have to create on my own, versus tools that apple already provides to help with this particular issue?


Solution

  • there are plenty of application on the app store which rely on both online as well as offline data

    what you should really be doing is on start of your app, run a background thread (which runs silently so your user never sees any delay). this thread downloads the latest data from your server and pushes it into your local database (sqlite is the best choice)

    make sure you implement some kind of data versioning so that your app only downloads data which is actually changed since last download - else you would unnecessarily be downloading the entire dataset which can be quite huge (depending upon your app requirements)

    also make sure to test for internet connectivity when doing this. if no internet is available, alert the user for sure

    this way you get the best of both worlds. users when away from internet can still use your app with their local sqlite data

    in iphone os 3.0 apple has introduced push services - where you can simply "PUSH" your data instead of doing a "PULL" however this is not available in the current iPhone OS (2.x.x)