哪个是将数据库初始数据下载到iOS应用程序的最佳方式? [英] Which is the best way to download database initial data to an iOS app?

查看:89
本文介绍了哪个是将数据库初始数据下载到iOS应用程序的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,在用户首次登录时必须从我的服务器下载大量数据并将其存储在我的i​​OS应用程序的本地数据库中。

I am developing an application that on the user's first login must download a lot of data from my server and store it in a local database in my iOS app.

在我的服务器中,我正在使用MySQL。我需要下载70MB ...到我的iOS应用程序才能在本地使用这些数据,无论是否连接。

In my server I am using MySQL. And I need to download 70MB... to my iOS app to use this data locally, having or not connection.

下载此数据的最佳方法是什么? XML压缩?导出到SQLite文件,压缩此文件并下载?

What's the best way to download this data? XML zipped? Export to a SQLite file, zip this file, and download?

您能推荐任何方法吗?

推荐答案

如果服务器上的数据库是动态的;一个好的方法是构建一个用于访问服务器上的数据库数据的API,你可以通过PHP构建一个API,并让应用程序只读取数据的响应为JSON或XML。

If the database on the server is dynamic; A good approach is to build an API for accessing the Database data on the server, you can build an API through PHP and have the app just read the responses of data as JSON or XML.

如果数据库是静态的并且不经常更新的另一种方法是将SQL数据库作为SQLite数据库添加到IOS应用程序,并在应用程序上运行本地sql查询。

Another approach if the database is static and wont update frequently is to add the SQL database to the IOS app as an SQLite database and just run local sql queries on the app.

这篇关于哪个是将数据库初始数据下载到iOS应用程序的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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