Dropbox、核心数据和 JSON

发布于 2024-11-30 19:00:33 字数 1073 浏览 0 评论 0原文

我已经尝试用谷歌搜索这个几天了,但我仍然很困惑,所以我想我会在这里尝试。

我有一个 iPhone 应用程序,它使用 Core Data 和 sqlite 数据库。我正在尝试使用 Dropbox 实现简单的数据库备份/恢复。

我下载了 Dropbox SDK,就链接、上传和下载 .sqlite 文件而言,一切都运行良好。

但是,出于安全目的,我不希望用户有权访问实际的 .sqlite 文件。我在这些板上看到 JSON 一段时间了,所以我决定研究一下它。我认为这正是我所需要的。

说起来容易做起来难。我以前从未使用过 Java,也从未实现过像 JSON 这样的东西,所以我不得不尝试找出从哪里开始。

我基本上明白发生了什么,但我很难弄清楚该怎么做。我想我找到了一种将核心数据模型转换为 JSON 格式的方法(我在这里确实宽松地使用了术语“思考”)。但接下来呢 - 我究竟要上传什么到 Dropbox?我是否以某种方式将模型(JSON 格式)和数据库结合起来?什么内容会上传到 Dropbox?如果这对大多数人来说似乎是显而易见的,我很抱歉,但对我来说确实并不明显,而且我已经看过了。

我愿意做这项工作,但似乎我可以在没有一些基本指导和开始的情况下朝 90 个方向前进。我不想做任何花哨的事情来确定已更改的数据等 - 只是想备份/恢复整个数据库。我只需要一些基本的解释并指出正确的方向。一个简单的核心数据示例项目将是巨大的。

我不是一个经验丰富的程序员,但我学得很快。只需简单地分解它...

提前致谢。 JPK


谢谢安德鲁。我不想“放弃”我的应用程序的数据库结构,但我现在可以看到 json 字符串不会比该区域的 sqlite 文件好多少。我是一名自学程序员(全职妈妈),所以这对我来说都是很新鲜的。也许我想要加密?但 iPhone 应用程序是否允许这样做?我记得他们在我上传二进制文件时询问加密问题......我知道 iCloud 即将推出,我也计划实现这一点,但由于可以免费同步的数据量有限,我想要也能够进行简单的备份。我的许多用户都要求它 - 除了 iTunes 之外的备份,这确实不是一个很好的备份,因为您无法仅恢复一个应用程序的数据(您必须恢复 iDevice 上的所有应用程序)。嗯...关于如何以不易读取的方式上传文件有什么建议吗?在这种情况下加密是可行的方法吗?

I've tried to google this for a couple of days and I am still pretty confused, so I thought I would try here.

I have an iPhone app that uses Core Data with an sqlite database. I am trying to implement a simple backup/restore of the database with Dropbox.

I downloaded the Dropbox SDK, and I have everything running fine as far as linking, uploading and downloading my .sqlite file.

However, I don't want users to have access to the actual .sqlite file for security purposes. I have been seeing JSON on these boards for some time now so I decided to look into it. I think it is exactly what I need.

Easier said than done. I have never worked with Java and have never implemented anything like JSON before, so I have had to try to figure out where to start.

I understand basically what is going on, but I'm having a heck of a time figuring out how to do it. I think I found a way to get the Core Data model into JSON format (and I do use the term 'think' loosely here). But then what - what exactly do I upload to dropbox? Do I somehow combine the model (in JSON format) and the database? What gets uploaded to Dropbox? I'm sorry if this seems obvious to most, it really is not obvious to me, and I have looked.

I am willing to do the work, but it just seems like I could go in 90 directions without some basic guidance and a start. I am not trying to do anything fancy as far as determining data that has been changed, etc. - just want to backup/restore the whole database. I just need some basic explanation and to be pointed in the right direction. A simple core-data sample project would be tremendous.

I'm not an experienced programmer, but I am a fast learner. Just break it down easy...

Thanks in advance.
JPK


Thanks Andrew. I didn't want to 'give away' the database structure of my app, but i can now see that the json string wouldn't be much better than the sqlite file in that area. I am a teach-myself programmer (stay at home mom) so this is all pretty new to me. Maybe I want encryption? But is that allowed for iPhone apps anyway? I recall them asking about encryption when I have uploaded binaries.... I know that iCloud is coming out soon, and I do plan to implement that as well, but with the limited amount of data that can be synced for free, I want to be able to do a simple backup as well. Many of my users have asked for it - a backup in addition to that of iTunes, which really is not a great backup since you can't restore data for just one app (you would have to restore for all apps on the iDevice). Hmmm... Any suggestions as to how to upload the file in such a way that it is not easily readable? Is encryption the way to go in this situation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一桥轻雨一伞开 2024-12-07 19:00:33

JPK,

我认为你在这里跨越了多个溪流。

JSON 是一种数据传输格式。 IOW,它几乎与您正在尝试的架构无关。您几乎肯定会使用 JSON 与 Dropbox 进行通信。

我有一个问题:为什么您认为用户无法访问您发送到 Dropbox 的任何数据?我怀疑你可能错了。用户将有权访问一切。

你正在做大量的工作。您已经将 .sqlite 文件保存在 Dropbox 上。如果您这样做是为了进行备份,那么该数据正在许多其他场所进行备份。换句话说,你的任务可能没有实际意义,不值得你花时间。

我每天使用 JSON、REST 网络和 Core Data。如果您有具体问题,我很乐意回答。

安德鲁

JPK,

I think you're crossing multiple streams here.

JSON is a data transfer format. IOW, it has almost nothing to do with the architecture of what you are attempting. You will almost certainly use JSON to communicate with Dropbox.

I have a question: why do you think that the user won't have access to any data you send to Dropbox? I suspect that you are probably wrong. The user will have access to everything.

You are doing to an awful lot of work. You already have the .sqlite file being persisted on Dropbox. If you are doing this to make a backup, that data is being backed up in many other venues. In other words, your task is likely moot and unworthy of your time.

I use JSON, REST networks and Core Data daily. If you have a specific question, I am happy to answer it.

Andrew

望笑 2024-12-07 19:00:33

不要保存整个数据库,而是将 plist 文件保存到 Dropbox,您可以从中重建数据库。假设您的数据库中有很多额外的内容,您不希望用户看到,否则,如果所有数据都是用户生成的数据,则只需按原样备份数据库即可。

您也可以对其进行加密,但为什么呢?添加加密仅意味着您必须回答“是”,您使用加密,并且如果您选择加密,则可能无法向特定公司销售 - 这不是禁止的。

Instead of saving the whole database, save out a plist file to Dropbox that you can rebuild a database from. That's assuming you have a lot of extra stuff in your database you do not want the user to see, otherwise just back up the DB as-is if it's all user generated data.

You could also encrypt it but why? Adding encryption only means you have to answer "yes" that you use encryption and may not be able to sell to specific companies, should you choose to encrypt - it's not forbidden.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文