iPhone offline application with synchronization

后端 未结 5 1469
深忆病人
深忆病人 2021-01-29 23:52

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

5条回答
  •  [愿得一人]
    2021-01-30 00:16

    Push is probably not a viable option here, since the amount of data you can push is miniscule, and basically comes back to "tell my app to make a server call". We use an online/offline model in Satchel. Whenever we have to communicate with the server, we bundle that communication (a URL and possibly some POST data) and store it to a database. If we're online, we pull it right back out, send it, and when we get a valid response back, we remove the record from the database. If we're offline, those rows build up, and the next time we ARE online, they get sent out. This is not a workable model in all situations, but can be adapted to most.

    In 3.0, you've got access to CoreData, which is a great data management tool. Other than that, the NSURLXXX family is your friend.

提交回复
热议问题