gpt4 book ai didi

iphone - iOS - 在 Dropbox 上上传文件(用户登录)

转载 作者:行者123 更新时间:2023-12-01 17:00:28 24 4
gpt4 key购买 nike

我不明白 Dropbox API。

我有一个带有 CoreData 的应用程序。用户可以选择是否要将 SQlite 文件上传到 Dropbox。所以我做了一个设置选项卡,他可以在其中停用/激活 Dropbox 同步并输入 Dropbox 用户名和密码。 (是的,我知道 Dropbox 不想存储密码)。

如果用户更改任何内容,则应上传 SQLite 文件。
所以我不需要 Dropbox 功能的 ViewController。

我想要的是一个类似于 DropboxHelper 类(NSObject)的东西,具有类似的功能

+ (void)uploadFile;

在我的 Dropbox 帐户中,我创建了一个应用程序。我在 AppDelegate 中使用的 App Key 和 App Secret:
DBSession* session = [[[DBSession alloc] initWithConsumerKey:@"KEY"consumerSecret:@"SECRET"]autorelease]; <br>
[DBSession setSharedSession:session];
[session release];

对于上传,我需要一个 DBRESTClient。在我的上传功能中,我测试 session 是否已链接。如果没有,请登录用户:
if (![[DBSession sharedSession]isLinked]) {
[self.restClient loginWithEmail:@"USERNAME"
password:@"PASSWORD";
}

但是 session 总是链接的?!我必须像这样初始化 DBRESTClient:
restClient = [[DBRESTClient alloc] initWithSession:[DBSession sharedSession]];

所以我没有得到:

我需要 APP KEY 和 APP SECRET 才能使用 API(所以它的 API key )?

如果 session 已链接,我如何登录用户? (我不想使用 DBLoginController 登录)

如果我不在 AppDelegate 中初始化 session ,我如何使用 session 初始化 DBRESTClient?

通常可以像这样使用API​​吗?没有 Viewcontroller 而是使用 NSObject?

最佳答案

https://www.dropbox.com/developers/reference/bestpractice涵盖了这一点。

Never handle user login and password information. All application authentication is done using tokens exchanged via the Dropbox mobile app or website and the methods described in the authentication tutorial.



另一种说法是,Dropbox 不想让用户相信应用程序开发人员的密码。

关于iphone - iOS - 在 Dropbox 上上传文件(用户登录),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7339275/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com