I am in the process of learning the Dropbox SDK. I want to learn how to display the users Dropbox folders as well as give the user the option to upload the file f开发者_如何学Pythonrom my app to their Dropbox account.
I have looked through their example app but it is not giving me the info that I need.
Can someone help me with this please?
I think you might find this tutorial useful. http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html
You can call upload method on the DBRestClient object.
NSString* path = [self getDocumentPath];//or however you can obtain the path where your file is stored
[restClientObject uploadFile:@"filename" toPath:@"/" fromPath:path];
//you can choose to upload to the dropbox root directory(above) or a folder of your choice eg toPath:@"/myfolder"
Use loadMetaData for displaying the contents of dropbox folder
[restClientObject loadMetadata:@""];
you also have to implement loadedMetadata
function. Refer the tutorial above.
-(void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata{
NSMutableArray *list=[[NSMutableArray alloc] init];
for (DBMetadata *child in metadata.contents) {
[list addObject:child];
}
self.arrayFoldersList=[[NSMutableArray alloc] initWithArray:list];
[self.tableView reloadData];
}
[self.restClient loadMetadata:@""];
I think this will help you alot.
精彩评论