大数据库 - 在设备上显示数据的最佳方式? [英] Large database - Best way to display data on device?

查看:113
本文介绍了大数据库 - 在设备上显示数据的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在建立一个iOS应用程式,连结至资料库,并以非同步方式下载资料的JSON物件,并显示在表格检视中。

I am currently creating an iOS app, which connects to a database and asynchronously downloads a JSON object of data to display in a table view.

,这是一个确定的方法来做到。但是,当数据库开始变得更大时,这将导致巨大的不便。我相当精通Objective-C,但不是那么多在数据库方面的事情。从服务器获取这些数据的最好方法是什么,并保存在应用程序中?目前,我有一个自定义类对象存储JSON对象中每个对象的数据。然而,数据库将处理的应用程序的许多其他方面,例如邀请,登录和用户详细信息。

As it currently stands, this is an ok way to do it. However, when the database starts getting much larger, this will cause a massive inconvenience. I'm reasonably proficient in Objective-C but not so much in the database side of things. What would be the best way to get this data from the server, and keep it in the app? At the moment, I have a custom class object storing the data for each of the 'objects' in the JSON object. There will however be many other aspects of the app that the database will handle, such as invites, logins and user details.

核心数据是否要走?即,复制数据库(在一定程度上)并将其存储在本地,然后从那里访问。正如我所说,我不确定在这里采取哪条路线,所以任何建议都会真正赞赏。

Would core data be the way to go? I.e duplicating the database (to a certain extent) and storing it locally, then accessing from there. As I said, i'm not really sure which route to take here, so any advice would be real appreciated.

推荐答案

位置是用于处理位置(卫星(和wifi)定位)。

Core location is for handling location (satellite (and wifi) positionning).

我想你的意思是Core Data。核心数据是一个图形对象模型,它允许您将数据作为对象进行操作。你不直接挖掘数据库,你通过谓词(SQL中的where子句)请求对象instanciation和操作对象。

I guess you mean Core Data. Core Data is a graph object model which allows you to manipulate data as objects. You don't dig directly into the database, you ask for objects instanciation through predicates (kind of where clause in SQL) and the manipulate the objects.

这说明,它都取决于什么是大数据库。如果它真的很大,你可以考虑复制本地的一部分,并通过你的web服务请求从服务器剩下的什么。

This stated, it all depends on what is a "big" database. If it's really big you could consider copying locally a part of it and ask for what's remaining from the server through your webservice.

另一个问题,你可以问自己是数量的数据永远不会改变,如果您的网站数据库和您的应用程序数据库需要同步(如果您的网站数据库总是更改,那么它将是愚蠢的,在您的应用程序完全并同步您的应用程序..)。

Another question that you could ask yourself is the quantity of data that never change and if your website database and your app database needs to get synchronized (if your website database is always changing then it would be dumb to copy it in your app totally and always synced your app..).

链接:

Core Data简介

核心数据和数据库之间的区别(可爱可爱)

编辑:

您的数据需要保存吗?

A question you can ask yourself is where your data needs to be saved ?

如果你的应用程序只是打印总共200个单元格中的20个单元格,那么我会去你的200个单元格的总下载。其他单元格的负载将在第一次下载后没有延迟,尤其是如果您使用具有可重用单元格的表格视图单元格。

if your app is just for printing 20 cells out of a total of 200 cells then i would go for a total download of your 200 cells. The load of the other cells will be with no delay after first download, especially appreciated if you're using table view cells with reusable cells

是可以接受的延迟在20个第一单元格和20个之间?我认为没有真正的好的答案,你的问题,它取决于许多因素(您的应用程序的目的,可接受的时间之间的负载,是需要修改信息,并保存回服务器或本地,什么样的客户,你的应用程序将如何处理单元格,如果你在本地有一个数据库,它将完全独立于母亲数据库(如果没有,什么样的同步)等)

is a delay of some seconds acceptable between the 20 first cells and the 20 following ? I think there is no real "good" answer to your question, it depends on many factors (purpose of your app, acceptable time between loads, does the info needs to be modified and saved back to server or locally, what kind of customers, what your app will do with the cells, if you have a database locally will it be totally independant from "mother" database (if no, what kind of synchronization), etc.)

尝试根据我的理解你的需要总结事情,我会说,Web服务是好的,如果你只需要检索信息和利用它,而不保存回来(即使你可以做它实际上服务允许你这样做),如果你需要你的应用程序在某些方面独立于你的服务器,在本地有数据库是好的。

Trying to sum up things according to what I've understood of your needs, I would say that webservices is good if you just need to retrieve info and exploiting it after without saving it back (even if you can do it actually having services allowing you to do it), having a database locally is good if you need your app to be independant from your server in some ways.

只有你的关键回答所有这些,并根据您的需求和您的应用程序和您的客户的知识做出决定。

Only you has the key to answer all this and take a decision according to your needs and your knowledge of your application and your customers.

这篇关于大数据库 - 在设备上显示数据的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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