开发者

What's the best way to do one-way synching from a server-side database to iPhone?

开发者 https://www.devze.com 2022-12-17 10:46 出处:网络
I\'ve got a database on my server which is about 3mb big. I\'d like to ship that with my iphone application.

I've got a database on my server which is about 3mb big. I'd like to ship that with my iphone application.

The most important thing is that I'd like to promote changes to the database (insert, updates, deletes) to the iphone. What's the best way of doing that? I mean - what is necessary on - the server - the client (= iphone) - between; how to transfer this data?

I'm pretty free in using technologies serverside; right now, I've got an sq开发者_运维技巧lite-database on the server filled with the data I'd like to sync to the iphones.


How often do you need the database to be updated, and how urgent are the changes?

If the database updates are infrequent and non-urgent, I'd have the app check for a new version of the database on startup, and if it has changed, download the entire new file.

The app would always download a small metadata file from a known URL on startup. The metadata file contains an version identifier for the latest version and a location where that version of the database can be downloaded. If the version identifier has changed from the version the app already has, will download the new version. If the version identifier has not changed, or if it can't check, the app can keep using the version it has.

Pro tip: if you want to show a progress bar for the download, include the size of the database in the metadata file. Cell networks often have transparent proxies that strip out the Content-Length header from HTTP responses.


Try using web hooks.

The concept of a WebHook is simple. A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST.

A web application implementing WebHooks will POST a message to a URL when certain things happen. When a web application enables users to register their own URLs, the users can then extend, customize, and integrate that application with their own custom extensions or even with other applications around the web. For the user, WebHooks are a way to receive valuable information when it happens, rather than continually polling for that data and receiving nothing valuable most of the time. WebHooks have enormous potential and are limited only by your imagination! (No, it can't wash the dishes. Yet.)

You can find out more on Webhooks here: http://www.webhooks.org/ and http://webhooks.pbworks.com/


Wonder if you have considered using a Sync Framework to manage the synchronization. If that interests you can take a look at the open source project, OpenMobster's Sync service. You can do the following sync operations

  • two-way
  • one-way client
  • one-way device
  • bootup

Besides that, all modifications are automatically tracked and synced with the Cloud. You can have your app offline when network connection is down. It will track any changes and automatically in the background synchronize it with the cloud when the connection returns. It also provides synchronization like iCloud across multiple devices

Also, modifications in the Cloud are synched using Push notifications, so the data is always current even if it is stored locally.

Here is a link to the open source project: http://openmobster.googlecode.com

Here is a link to iPhone App Sync: http://code.google.com/p/openmobster/wiki/iPhoneSyncApp

0

精彩评论

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