简体   繁体   English

Dropbox API - 使用Dropbox作为服务器

[英]Dropbox API - Using Dropbox as a server

I was wanting to use a file sharing server to keep certain files up-to-date and constant across multiple instances of my application across multiple computers - like (for example) writing a multiplayer game, which stores all the player's positions in a text file, and uses something like Dropbox to keep the text file constant across all the applications, and each application instance can change the file with that application's player's position, and then the rest of the applications can update accordingly. 我想使用文件共享服务器来保持某些文件在多台计算机上的应用程序的多个实例中保持最新和不变 - 例如(例如)编写多人游戏,将所有玩家的位置存储在文本文件中并使用Dropbox之类的东西使文本文件在所有应用程序中保持不变,并且每个应用程序实例都可以使用该应用程序的播放器位置更改文件,然后其他应用程序可以相应地更新。 This is only an example, and is not what I intend to do using this technology. 这只是一个例子,并不是我打算用这种技术做的。 What I want to do does not rely on fast sharing of data very quickly - but only periodically downloading and updating the text file. 我想要做的并不是非常快速地依赖于快速共享数据 - 而只是定期下载和更新文本文件。

I was wondering how I might be able to do this using the Dropbox API for Objective-C without prompting the user for any Dropbox username/password - just store a single Dropbox account's login information, log into it automatically and update/download the file stored on it? 我想知道如何使用Dropbox API for Objective-C而不提示用户输入任何Dropbox用户名/密码 - 只需存储一个Dropbox帐户的登录信息,自动登录并更新/下载存储的文件在上面?

From what I have found out from experimenting, Dropbox prompts users for their passwords via a web-broswer, and is designed to accommodate multiple accounts, whereas I only need to accommodate the 'Server' account. 根据我从实验中发现的内容,Dropbox通过web-broswer提示用户输入密码,并且旨在容纳多个帐户,而我只需要容纳“服务器”帐户。

So, is there anyway to do this sort of thing using the Dropbox API, or should I use something else. 那么,无论如何使用Dropbox API做这种事情,或者我应该使用别的东西。 Or do I need to find out how to write my own server. 或者我是否需要了解如何编写自己的服务器。 Using some sort of file sharing API seems a lot easier to me than writing an actual server. 使用某种文件共享API似乎比编写实际的服务器容易得多。

Thanks for any help, 谢谢你的帮助,

Ben

You might think about using Google App Engine (GAE). 您可能会考虑使用Google App Engine(GAE)。 I had a similar requirement recently and I'm thinking this is a good option when you want centralized data. 我最近有类似的要求,我认为当你想要集中数据时,这是一个很好的选择。 Plus you can do the no-browser account login by using your own custom authentication, or I think it's even possible via OAuth? 另外,您可以使用自己的自定义身份验证进行无浏览器帐户登录,或者我认为甚至可以通过OAuth进行登录? Depends on how sensitive the data is I guess. 取决于我猜测数据的敏感程度。 I just rolled my own. 我只是自己动手了。

From my research I found that using Dropbox as a server has some issues with scalability, since you'll be limited to maybe 5,000 calls per day. 根据我的研究,我发现使用Dropbox作为服务器存在一些可扩展性方面的问题,因为你每天只能拨打5,000个电话。 source It's built on Amazon S3, so you could also look at using that directly. source它是基于Amazon S3构建的,因此您也可以直接使用它。

GAE lifts that limit up to 675,000, but can be increased up to 91 million for free. GAE提升限制高达675,000,但可以免费增加到9100万。 https://developers.google.com/appengine/docs/quotas https://developers.google.com/appengine/docs/quotas

I did find an open-source project for doing this with Java , alternative you could look at Python example 我确实找到了一个用Java做这个的开源项目,另外你可以看一下Python的例子

I've written a daemon that continuously checks for updated files and syncs them. 我编写了一个守护进程,不断检查更新的文件并同步它们。 I wrote it for my own file manager iOS app. 我为自己的文件管理器iOS应用程序编写了它。 You can find the implementation here: 你可以在这里找到实现:

https://github.com/H2CO3/MyFile/tree/master/DropboxDaemon https://github.com/H2CO3/MyFile/tree/master/DropboxDaemon

I'm personally not an iOS developer but I came across this question while looking for something else and thought I would offer up another potential solution to the OP's question. 我个人不是iOS开发人员,但我在寻找其他东西时遇到了这个问题,并且认为我会提出另一个可能解决OP问题的方法。

Microsoft just released something called Azure Mobile Services which supports iOS development (among other platforms). 微软刚刚发布了支持iOS开发的Azure移动服务(以及其他平台)。 It's basically a convenient way to set up a back end system complete with push notifications, authentication, etc. without rolling your own. 它基本上是一种方便的方法来设置后端系统,完成推送通知,身份验证等,而无需自己动手。 You don't need to know anything about Azure or servers as the setup process walks you through most of it. 您无需了解Azure或服务器的任何信息,因为安装过程会引导您完成大部分操作。 It is new so keep that in mind, but it looks promising for situations like this. 它是新的,所以记住这一点,但它看起来很有希望这样的情况。

Here's a 10 minute video explaining how to use it with an iOS developed app along with links to more documentation: http://channel9.msdn.com/posts/iOS-Support-in-Windows-Azure-Mobile-Services/ 这是一个10分钟的视频,解释了如何在iOS开发的应用程序中使用它以及更多文档的链接: http//channel9.msdn.com/posts/iOS-Support-in-Windows-Azure-Mobile-Services/

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM