开发者

How to sync iPhone and Mac CoreData objects through bonjour?

开发者 https://www.devze.com 2022-12-23 04:49 出处:网络
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 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 t开发者_JAVA技巧he 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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消