简体   繁体   English

在Iphone App的保管箱中创建文件夹

[英]Create a folder in dropbox from Iphone App

I am a beginner in iOS development and have just started using the DropBox SDK for iOS. 我是iOS开发的初学者,刚开始使用iOS的DropBox SDK。 I am using XCode 3.2.5 having the simulator 4.2 . 我正在使用具有模拟器4.2的XCode 3.2.5。 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. 我想以编程方式使用DropBox SDK在Dropbox帐户上创建一个文件夹(或目录),然后将文件直接上传到我的DropBox帐户中的该文件夹。 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). 我必须将此文件存储在一个名为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. 我已经在iOS的DropBox SDK版本1.1中查找了API,但是,它没有递归上载目录或其所有内容的功能。 So, Will I have to traverse recursively over the contents of a directory and send multiple requests? 因此,我是否必须递归遍历目录的内容并发送多个请求? Please help 请帮忙

This is used to create a Folder in DropBox 这用于在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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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