Dropbox在iphone中下载问题

Nir*_*tel 3 iphone xcode objective-c ios

您好,我在我的应用中使用Dropbox API.我想从我的Dropbox帐户下载图像并将它们存储在模拟器或设备目录中.我使用Full DropBox Access在Dropbox中创建了应用程序.但它给了我这个错误:

[警告] DropboxSDK:向/ 1/files/sandbox/Photos发出错误请求 - App文件夹(沙盒)访问尝试失败,因为此应用程序未配置为具有应用程序文件夹.您的访问类型应该是"dropbox"吗?

这是我的代码

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];
Run Code Online (Sandbox Code Playgroud)

Son*_*lin 9

设置Dropbox会话时,必须设置正确的根目录:

DBSession* dbSession =
    [[DBSession alloc]
      initWithAppKey:@"APP_KEY"
      appSecret:@"APP_SECRET"
      root:kDBRootDropbox]; // either kDBRootAppFolder or kDBRootDropbox
    [DBSession setSharedSession:dbSession];
Run Code Online (Sandbox Code Playgroud)

在您的情况下,因为您正在使用完整的Dropbox,您需要将root设置为KDBRootDropbox.