简体   繁体   English

Dropbox在iphone中下载问题

[英]Dropbox Downloading issue in iphone

Hello, I am using the Dropbox API in my app. 您好,我在我的应用中使用Dropbox API。 I want to download images from my dropbox account and store them in the simulator or in the device directory. 我想从我的Dropbox帐户下载图像并将它们存储在模拟器或设备目录中。 I have created app in dropbox using Full DropBox Access. 我使用Full DropBox Access在Dropbox中创建了应用程序。 But it's giving me this error : 但它给了我这个错误:

[WARNING] DropboxSDK: error making request to /1/files/sandbox/Photos - App folder (sandbox) access attempt failed because this app is not configured to have an app folder. [警告] DropboxSDK:向/ 1 / files / sandbox / Photos发出错误请求 - App文件夹(沙盒)访问尝试失败,因为此应用程序未配置为具有应用程序文件夹。 Should your access type be 'dropbox' instead? 您的访问类型应该是“dropbox”吗?

Here is my code 这是我的代码

restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate = self;
NSString *fileName = [NSString stringWithFormat:@"/avatar.jpg"];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
                                                     NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

NSString* path2 = [documentsDirectory stringByAppendingString:
                            [NSString stringWithFormat:@"%@", fileName]];

[restClient loadFile:fileName intoPath:path2];

When you set up your Dropbox session, you have to set the correct root: 设置Dropbox会话时,必须设置正确的根目录:

DBSession* dbSession =
    [[DBSession alloc]
      initWithAppKey:@"APP_KEY"
      appSecret:@"APP_SECRET"
      root:kDBRootDropbox]; // either kDBRootAppFolder or kDBRootDropbox
    [DBSession setSharedSession:dbSession];

In your case because you're using full dropbox, you need to set root to KDBRootDropbox. 在您的情况下,因为您正在使用完整的Dropbox,您需要将root设置为KDBRootDropbox。

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

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