简体   繁体   中英

App is not allowed to access this api for Dropbox

I'm trying to use the Dropbox API for my iPhone app, so I got a simple programm who just link my Dropbox account to the app (this part works well), but when I try to list files in my Dropbox directory i got this message:

[WARNING] DropboxSDK: error making request to /l/metadata/dropbox - (400) App is not allowed to access this API.

And I got this message, even if I try the DBRoulette given by Dropbox for testing their API.

Maybe it's because I use the simulator, but I cant try this on a device now.

When you created your app in the App console , what type of app did you create? My guess is that you created a datastores-only app, and you're now trying to access files via the API. Make sure you create an app that has access to files.

It tells that there is some wrong input parameter in api,

400 Bad input parameter. Error message should indicate which one and why.

From Drop box documentation .

The Dropbox API shows some sample code for listing the files in a given folder:

List files in a folder

You can list the files in folder you just uploaded to with the following call:

[[self restClient] loadMetadata:@"/"];
The rest client will call your delegate with one of the following callbacks:

- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata {
    if (metadata.isDirectory) {
        NSLog(@"Folder '%@' contains:", metadata.path);
    for (DBMetadata *file in metadata.contents) {
        NSLog(@"\t%@", file.filename);
    }
    }
}

- (void)restClient:(DBRestClient *)client
    loadMetadataFailedWithError:(NSError *)error {

    NSLog(@"Error loading metadata: %@", error);
}

Metadata objects are how you get information on files and folders in a user's Dropbox. Calling loadMetadata: on / will load the metadata for the root folder, and since it's a folder the contents property will contain a list of files and folders contained in that folder. It's advisable to keep this data around so that the next time you want to do something with a file, you can compare its current metadata to what you have stored to discern whether the file has been changed. Check out DBMetadata.h to see all the information metadata objects have.

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