簡體   English   中英

Dropbox在iphone中下載問題

[英]Dropbox Downloading issue in iphone

您好,我在我的應用中使用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];

設置Dropbox會話時,必須設置正確的根目錄:

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

在您的情況下,因為您正在使用完整的Dropbox,您需要將root設置為KDBRootDropbox。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM