Create a folder in dropbox from Iphone App

試著忘記壹切 提交于 2019-11-30 21:05:28

问题


I am a beginner in iOS development and have just started using the DropBox SDK for iOS. I am using XCode 3.2.5 having the simulator 4.2 . I wanted to create a folder(or directory) on my dropbox account using the DropBox SDK programmatically and upload files directly to that folder in my DropBox account. I have the following code to upload a file

[[self restClient] uploadFile:@"info.txt" toPath:@"/" withParentRev:nil fromPath:sourceString];

I have to store this file inside a folder called TempData(suppose). Then, I tried doing the following

[[self restClient] uploadFile:@"info.txt" toPath:@"/TempData/" withParentRev:nil fromPath:sourceString];

but, it uploaded the file in the default directory for my App. Also, can I upload the contents of an entire directory in to my dropbox account. I have a lot of metadata files which need to be uploaded along with the uploaded files. So, is there a way to upload the entire contents of a folder to dropbox. I have looked up the API in DropBox SDK version 1.1 for iOS, but, it does not have any facility to upload an a directory or all of its contents recursively. So, Will I have to traverse recursively over the contents of a directory and send multiple requests? Please help


回答1:


This is used to create a Folder in DropBox

[[self restClient] createFolder:@"/YourFolder"];

This is Used to get details of the newly created folder

// Folder is the metadata for the newly created folder
- (void)restClient:(DBRestClient*)client createdFolder:(DBMetadata*)folder{
    NSLog(@"Created Folder Path %@",folder.path);
        NSLog(@"Created Folder name %@",folder.filename);
}
// [error userInfo] contains the root and path
- (void)restClient:(DBRestClient*)client createFolderFailedWithError:(NSError*)error{
    NSLog(@"%@",error);
}


来源:https://stackoverflow.com/questions/8986334/create-a-folder-in-dropbox-from-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!