与DropBox API和iOS进行数据同步 [英] Data syncing with DropBox API and iOS

查看:135
本文介绍了与DropBox API和iOS进行数据同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS应用,该应用将数据存储在本地目录中.我希望能够在运行我的应用程序的多个设备之间同步此数据.当前,此操作使用的是核心数据,但我希望必须更改为某些基于文本的文件存储系统,以使同步更加容易.

I have an iOS app which stores data in the local directory. I'd like to be able to sync this data between multiple devices running my app. Currently this is using core data, but I'd expect to have to change to some text-based file storage system to make syncing easier.

我期望DropBox API可以使它变得简单易用,并且我可以告诉API在启动/保存时仅同步我的数据文件夹的内容.但是,似乎DropBox API只是一种上传和下载文件的美化方式.

I was expecting the DropBox API would make this nice and easy, and that I could tell the API to simply sync the contents of my data folder on startup/save. However it seems the DropBox API is nothing more than a glorified way of uploading and downloading files.

我在这个假设上错了吗? DropBox API是否真的可以轻松地使充满文本文件的文件夹保持同步?如果没有,您还有其他服务或建议吗?同步非常困难-我希望DropBox可以使之更容易.

Am I wrong on this assumption? Can the DropBox API actually make it easy to keep a folder full of text files in sync? If not, is there some other service or even advice you can give? Syncing is hard - I was hoping DropBox would make it easier.

推荐答案

使用/metadata ,获取有关文件夹的内容再简单不过了.您需要做的只是检查modified日期,如果它与本地日期不同,请执行适当的操作.它还会为您提供任何文件内容的元数据,因此您可以根据需要选择需要上载/下载/添加/删除的文件.

Using /metadata, getting information about the contents of a folder couldn't be easier. All you need to do is check the modified date, and if it's different than yours locally, perform the appropriate action. It will also give you the metadata for any file contents, so you can pick out which files need to be uploaded / downloaded / added / removed as necessary.

比这更多的功能将取决于应用程序;您可以自行决定何时以及如何处理不同的文件.

Any more functionality than this would be very application-dependent; you can decide for yourself when and how you want to deal with differing files.

Dropbox API文档

这篇关于与DropBox API和iOS进行数据同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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