Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am converting to objective C API v2. I wrote this route to verify if a file is in a dropbox directory called DA. I get on the NSLog that the file exits, but the BOOL return value of the function is always 0. Any help would be appreciated.
- (BOOL)verifyFileInDropboxWith:(NSString *)fileName { __block BOOL fileOnDB = NO; NSString *dBFilePath = [NSString stringWithFormat:@"/DA/%@",fileName]; DropboxClient *client = [DropboxClientsManager authorizedClient]; [[client.filesRoutes getMetadata:dBFilePath] response:^(DBFILESMetadata *result, DBFILESGetMetadataError *routeError, DBError *error){ if([result.name containsString:fileName]) { NSLog(@"File already exists DB"); fileOnDB = YES; } else { NSLog(@"File does not exist in DB"); fileOnDB = NO; } }]; return (fileOnDB); }
Your function does this
set return value to NO
call a block ( which takes some time, asynchronously )
immediately return the return value
The block will not set it to another value until it's done the dropbox API call.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!