Sync master data between iPhone and iPad

I have a generic iPhone / iPad app that uses Core Data as storage. I would like users to be able to sync their data between two devices (iPhone, iPod and iPad).

Is there any example application or code that accomplishes this?

+2


a source to share


2 answers


You just need to write a regular Core Data application and as a general Core-Data-agnostic problem figure out a good way to batch exchange data between two network devices.

One way is to use JSON or XML to encapsulate Core Data entity data synchronized between the two devices. You can run web servers on both devices to exchange data containing JSON or XML encapsulated data.



When the web server receives a request and a dataset, it then adds the new object to the master data store just like any other local application.

Just search Google or your favorite search engine for "JSON", "XML" and "Web Services". There are many third-party Objective-C frameworks out there for handling JSON and XML, and for making and receiving web requests.

+1


a source


To resurrect this question: does the new entity add relationships that existed in another persistent store? For instance:

The user sets object A, which is related to object B (the opposite is true) on the iPhone. The user is syncing the app with the iPad version (which has no data) - the only way to successfully complete the sync is to paste a new object A and B whose attributes and relationships are "copied" from the synced objects. Since you've now added new managed objects to the new persistent store, did the iPad app have the right relationship?



The Core Data docs make it clear that two managed objects cannot belong to multiple persistent stores, while advets can insert a new object with the same data. However, I am concerned that by doing this, the relationship will not be properly set up.

0


a source







All Articles