如何通过bonjour同步iPhone和Mac CoreData对象?
我知道以前也有人问过类似的问题。 我正在使用此处在线找到的同步演示应用程序,该应用程序使用图片共享 作为指南。
我已将其集成到我的桌面和 iPhone 应用程序中,并且连接正常,但我不知道如何实际同步我的对象。
就像
if ([iphone Object] != [desktop object])
{
//What goes here?
}
我使用完全相同的对象模型一样简单吗,我基本上只是想知道如何检查是否存在差异,并复制不同的差异。
有人知道任何可以显示这一点的示例代码吗?
非常感谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试过 Marcus Zarra 的 ZSync 吗?它是使用 Bonjour 在 Mac、iPhone 等之间同步 Core Data 的开源实现。
Have you tried out Marcus Zarra's ZSync? It's an open source implementation of Core Data syncing between Mac, iPhone, etc. using Bonjour.
您可以使用时间戳列(例如——revisionTimestamp)来解决这个问题,该列可用作简单的比较并允许您识别最新的更新。
只需确保您的保存逻辑在更新完成时自动更新该列。
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.