views:

402

answers:

2

I know similar questions have been asked before. I'm using the Sync Demo app I found online here, which uses Picture Sharing as a guide.

I've integrated it into my desktop and iphone apps and have the connection working, but am clueless as to how to actually sync my objects.

Is it as simple as

if ([iphone Object] != [desktop object])
{
 //What goes here?
}

I have the exact same object model used, I just basically want to know how to check if there are differences, and copy the ones that are different over.

Anyone know of any sample code anywhere that would show this?

Thanks so much.

A: 

You could solve this with a timestamp column (e.g. - revisionTimestamp) that could be used to as a simple comparison and allow you to identify the most recent update.

Just make sure that your save logic updates the column automatically whenever an update is done.

xyzzycoder
Thanks for the input. I figured I'd have to use a timeStamp to resolve when each was edited.What I'm asking is, how to I actually copy an object from the iphone to the desktop or vice-versa in code?
monotreme
+2  A: 

Have you tried out Marcus Zarra's ZSync? It's an open source implementation of Core Data syncing between Mac, iPhone, etc. using Bonjour.

Brad Larson