从WebService(Json / XML)为iOS的同步数据库(sqlite) [英] Syncing Database (sqlite) from WebService(Json/XML) for iOS

查看:308
本文介绍了从WebService(Json / XML)为iOS的同步数据库(sqlite)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务和sqlite数据库。在这里,web服务将用于存储数据库内的数据。现在我想将同步功能包括在内 - 每当应用程序启动时,数据库将开始通过Web服务加载其表的数据。



现在,在我更新我的网络服务后,数据库将相应更新。我的问题是,这个更新我必须遵循的最佳做法是什么。我应该清除整个数据库,并开始添加所有的行(我知道这将需要很多时间),但如果不是这样,那么我的数据库将如何添加从Web服务的特定数据?



谢谢。

解决方案

我建议你:


$ b $

  • 在数据库中只显示您的内容。
  • $

    因此,您将始终可以找到所有您的新鲜数据到数据库。


    I have a Web Service and sqlite database. In this, web service will be used to store data inside database. Now I want to include sync functionality as - Whenever application starts at that time the database will start to load its table's data through web service.

    Now after some time when I update my my web service the database will be updated accordingly. My question is that what are the best practices that I must follow for this update. Should I clear whole DB and start adding all rows again(I know this will take a lot time) but If not this then how do my database will add only particular data from the web service?

    Thank you.

    解决方案

    What I suggest you is:

    1. store all your webservice content into db first when the app starts.
    2. display your content on the screen from db only.
    3. again when you need to refresh or recall your data just update the database.

    Thus, you will always find all your fresh data into database.

    这篇关于从WebService(Json / XML)为iOS的同步数据库(sqlite)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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