简体   繁体   中英

Dropbox Downloading issue in iphone

Hello, I am using the Dropbox API in my app. I want to download images from my dropbox account and store them in the simulator or in the device directory. I have created app in dropbox using Full DropBox Access. 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. Should your access type be 'dropbox' instead?

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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