2012-10-09 6 views
2

IOS 용 Google 드라이브 API를 통합하려고합니다. API는 같은 파일을 다운로드 할 때 내가 그들의 예를 테스트입니다 program here모든 마임 유형을 얻는 방법 Google 드라이브 Api IOS

그들은 그런 그들이 파일을 업로드 할 때와 같이 업로드하거나 MIME 형식을 사용하여 파일을 다운로드 DrEdit 일명

[GTLUploadParameters uploadParametersWithData:fileContent MIMEType:@"text/plain"];

사용 GTLQueryDrive *query = [GTLQueryDrive queryForFilesList]; query.q = @"mimeType = 'text/plain'";

파일의 JSON 값

{ 
    "kind": "drive#file", 
    "id": string, 
    "etag": etag, 
    "selfLink": string, 
    "title": "file_name", 
    "mimeType": "mime/type", 
    "description": "Stuff about the file" 
    ... 
    "downloadUrl": string, 
    ... 
} 

가 지금은 ... 어떻게 등등 PDF, 문서 등 다양한 파일 확장자를 가지고 사용자 폴더에있는 모든 파일을 다운로드 할 수 있습니다 내가 표시 할 수있는 방법

를 궁금해/사용자의 모든 문서는 드라이브 계정을 구글 목록?

+0

확인 Google 드라이브의 [워드 프로세서] (https://developers.google.com/drive/scopes#requesting_full_drive_scope_for_an_app) 당신은 (읽기 전용) 모든 파일을 조회 할 수 있습니다 어쩌면 거기에서 당신은 다운로드 할 파일을 선택할 수 있습니다. – ender

답변

0

Mime types

나는 구글 드라이브가 지원하는이 MIME 유형을 발견했다. U는 다운로드 또는 업로드시이를 사용할 수 있습니다.

6

두 가지 : 빈 쿼리가 모든 파일을 반환하는 것

1) : kGTLAuthScopeDrive) :

query.q = @""; 

2) 정식 (initWithScope에있는 모든 파일에 대한 액세스를 요청해야합니다. DrEdit 예제는 기본적으로 앱에서 만든 파일에만 액세스합니다.

GTMOAuth2ViewControllerTouch *authViewController = 
    [[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive // Auth to all files and docs 
              clientID:kClientId 
             clientSecret:kClientSecret 
            keychainItemName:kKeychainItemName 
              delegate:self 
            finishedSelector:finishedSelector]; 
관련 문제