2

我正在尝试为 IOS 集成 Google Drive Api。我在这里测试他们的示例程序

又名 DrEdit,当他们上传或下载他们使用 mimetype 的文件时,例如当他们上传文件时

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

当 api 下载它使用的相同文件时

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、doc 等...

如何显示/列出用户 google drive 帐户中的所有文档?

4

2 回答 2

6

两件事情:

1)空查询似乎返回所有文件:

query.q = @"";

2)确保您请求访问身份验证中的所有文件(initWithScope:kGTLAuthScopeDrive)。DrEdit 示例默认只访问应用程序创建的文件。

GTMOAuth2ViewControllerTouch *authViewController = 
  [[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive    // Auth to all files and docs
                                             clientID:kClientId
                                         clientSecret:kClientSecret
                                     keychainItemName:kKeychainItemName
                                             delegate:self
                                     finishedSelector:finishedSelector];
于 2013-02-07T07:28:27.043 回答
0

哑剧类型

我发现了谷歌驱动器支持的这种 mime 类型。您可以在下载或上传时使用它们。

于 2012-10-12T06:47:14.943 回答