如何从ios中的iphone应用程序将Sqlite数据库文件上传到服务器 [英] how to upload Sqlite database file to server from iphone application in ios

查看:66
本文介绍了如何从ios中的iphone应用程序将Sqlite数据库文件上传到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序中,我使用sqlite3创建数据库.现在,我想备份服务器上的数据库文件.

那么如何将我的sqlite db文件从iPhone中的应用程序上传到服务器?

解决方案

我将把sql数据库读入JSON对象,然后通过URL将该URL上传到服务器,该URL沿

有关Apple开发人员文档中JSON负载的更多信息,请参见 SBJson

In my iphone application i used sqlite3 for creating database. Now i want to take backup of a database file on my server.

so how to upload my sqlite db file to server from my application in iphone?

解决方案

I would read the sql database into a JSON object, then upload it to a server via a URL that calls a PHP script along the lines of this stack overflow answer!

Here's an example of some mySQL data wrapped into JSON:

{database:{"col1":"56","col2":"85","col3":"some_text"},
{"col1":"57","col2":"86","col3":"next row"} }

More about JSON payloads in Apple dev docs here JSON

As of iOS5.x, Apple now includes some JSON helper classes, see NSJSONSerialization class reference along with the Twitter example app.

I have used this the SBJson framework in the past for iOS SBJson

这篇关于如何从ios中的iphone应用程序将Sqlite数据库文件上传到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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