ios - How to Sync iPhone Core Data with web server, and then push to other devices? -


i have been working on method sync core data stored in iphone application between multiple devices, such ipad or mac. there not many (if @ all) sync frameworks use core data on ios. however, have been thinking following concept:

  1. a change made local core data store, , change saved. (a) if device online, tries send changeset server, including device id of device sent changeset. (b) if changeset not reach server, or if device not online, app add change set queue send when come online.
  2. the server, sitting in cloud, merges specific change sets receives master database.
  3. after change set (or queue of change sets) merged on cloud server, server pushes of change sets other devices registered server using sort of polling system. (i thought use apple's push services, apparently according comments not workable system.)

is there fancy need thinking about? have looked @ rest frameworks such objectiveresource, core resource, , restfulcoredata. of course, these working ruby on rails, not tied to, it's place start. main requirements have solution are:

  1. any changes should sent in background without pausing main thread.
  2. it should use little bandwidth possible.

i have thought number of challenges:

  1. making sure object ids different data stores on different devices attached on server. say, have table of object ids , device ids, tied via reference object stored in database. have record (databaseid [unique table], objectid [unique item in whole database], datafield1, datafield2), objectid field reference table, allobjects: (objectid, deviceid, deviceobjectid). then, when device pushes change set, pass along device id , objectid core data object in local data store. cloud server check against objectid , device id in allobjects table, , find record change in initial table.
  2. all changes should timestamped, can merged.
  3. the device have poll server, without using battery.
  4. the local devices need update held in memory if/when changes received server.

is there else missing here? kinds of frameworks should @ make possible?

i suggest reading , implementing sync strategy discussed dan grover @ iphone 2009 conference, available here pdf document.

this viable solution , not difficult implement (dan implemented in several of applications), overlapping solution described chris. in-depth, theoretical discussion of syncing, see paper russ cox (mit) , william josephson (princeton):

file synchronization vector time pairs

which applies equally core data obvious modifications. provides overall more robust , reliable sync strategy, requires more effort implemented correctly.

edit:

it seems grover's pdf file no longer available (broken link, march 2015). update: link available through way machine here

the objective-c framework called zsync , developed marcus zarra has been deprecated, given icloud seems support correct core data synchronization.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -