2012-01-24 3 views
0

저는 iOS Development의 초보자이며 방금 App 개발을 위해 DropBox SDK를 사용하기 시작했습니다.iPhone SDK를 사용하여 DropBox에 폴더 업로드

현재 XCode 3.2.5를 사용 중이며 시뮬레이터 버전 4.2를 사용 중입니다. iPhone 용 DropBox SDK를 사용하여 n 개의 파일을 포함하는 전체 폴더 (디렉토리)의 내용을 App 계정에 직접 업로드 할 수있는 방법이 있는지 알고 싶습니다.

인터넷을 통해 다양한 포럼에서 토론을했지만이 문제를 해결하기위한 답을 찾을 수 없었습니다. 이 문제에 대한 가능한 해결 방법이 있습니까? 그렇다면 어떻게 구현할 수 있습니까? 도와 주실 수 있니?

편집 : iOS 용 DropBox SDK 버전 1.1에서 API를 찾았지만 디렉토리 나 모든 내용을 재귀 적으로 업로드 할 수있는 기능이 없습니다. 그래서, 디렉터리의 내용을 재귀 적으로 탐색하고 여러 요청을 보내야합니까? 도와주세요.

+0

@Abizern 편집 된 질문을 수행하십시오. 미안하지만, StackOverflow를 처음 접했을 때 제 질문의 형식이 올바르지 않으면 질문을하기 전에 그 점을 명심하십시오. :) – An1Ba7

+0

@Abizern 예, API를 살펴본 후 API를 사용하여 응용 프로그램에 파일을 업로드하고 다운로드했습니다. 문제는 업로드되는 파일과 함께 많은 메타 데이터 파일을 보내고 있다는 것입니다. 그래서, 그 이유는 내 질문에 해결 방법 솔루션이 있는지 알고 싶었 .. – An1Ba7

+0

자신의 질문 중복 가능한 가능한 http://stackoverflow.com/questions/8986334/create-a-folder-in-dropbox-from -iphone-app. 다른 질문을하기보다는 업데이트 된 정보로 원래 질문을 업데이트하십시오. – Abizern

답변

0

가장 쉬운 방법은 다음과 같이이다 : 여기

 
NSFileManager *fmgr = [NSFileManager defaultManager]; 
NSString *localDirectoryPath = @"path/to/directory"; 
NSArray *subPaths = [fmgr subpathsOfDirectoryAtPath:localDirectory error:&error]; 


for(NSString *path in subPaths){ 
     BOOL isDir; 
     NSString *localPath = [userDir URLByAppendingPathComponent:path].path; 
     [fmgr fileExistsAtPath:localPath isDirectory:&isDir]; 
     if(!isDir){ 
      NSString *filename = [path lastPathComponent]; 

      NSString *destPath = [[[@"/" stringByAppendingPathComponent:@"base/path"] 
stringByAppendingPathComponent:path.stringByDeletingLastPathComponent] 
            stringByAppendingString:@"/"]; 

      [[self restClient] uploadFile:filename toPath:destPath withParentRev:nil fromPath:localPath]; 
     } 
    } 
관련 문제