iPhone离线应用程序与同步 [英] iPhone offline application with synchronization

查看:227
本文介绍了iPhone离线应用程序与同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个应用程序,它的工作原理在线下,离线和在线。由于应用程序在离线时无法与服务器通信,因此需要进行某种程度的同步。

I'm looking into building an application which works just as well offline as it does online. Since the application cannot communicate with the server while in offline, there is some level of synchronization which needs to take place.

有一些好的工具可以阅读,开始思考关于何时为您的iPhone进行同步规划离线操作?

What are some good tools to read about and start thinking about when planning offline operations with synchronization for your iPhone?

我需要自己创建哪些工具,而苹果已经提供了哪些工具来帮助解决这个问题?

What tools would I have to create on my own, versus tools that apple already provides to help with this particular issue?

推荐答案

在应用商店中有大量的应用程序,依赖于在线和离线数据

there are plenty of application on the app store which rely on both online as well as offline data

你真正应该做的是在你的应用程序启动,运行一个后台线程(静默运行,所以你的用户从来没有看到任何延迟)。此线程从您的服务器下载最新数据并将其推送到您的本地数据库(sqlite是最好的选择)

what you should really be doing is on start of your app, run a background thread (which runs silently so your user never sees any delay). this thread downloads the latest data from your server and pushes it into your local database (sqlite is the best choice)

确保您实现某种数据版本控制,应用程式只会下载自上次下载以来实际已变更的资料,否则您将不必要地下载整个资料集,这可能相当庞大(视您的应用程式需求而定)。

make sure you implement some kind of data versioning so that your app only downloads data which is actually changed since last download - else you would unnecessarily be downloading the entire dataset which can be quite huge (depending upon your app requirements)

当这样做时,一定要测试互联网连接。如果没有可用的互联网,提醒用户肯定

also make sure to test for internet connectivity when doing this. if no internet is available, alert the user for sure

这样你就能获得最好的两个世界。用户远离互联网时仍然可以使用您的应用程序与他们本地的sqlite数据

this way you get the best of both worlds. users when away from internet can still use your app with their local sqlite data

在iphone os 3.0苹果已经推出推送服务 - 在那里你可以简单地推你的数据的PULL,但是这在当前的iPhone OS(2.xx)

in iphone os 3.0 apple has introduced push services - where you can simply "PUSH" your data instead of doing a "PULL" however this is not available in the current iPhone OS (2.x.x)

这篇关于iPhone离线应用程序与同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆