【问题标题】:How to get a list of files Google Drive API IOS?如何获取 Google Drive API IOS 的文件列表?
【发布时间】:2012-10-18 06:40:10
【问题描述】:

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

DrEdit 在上传或下载文件时使用 mimetype,例如上传文件时

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

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

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

我可以上传和下载在Dr.Edit 制作的文件,但如果我使用网络界面或使用mac os 的本地驱动器客户端修改或创建文件。这些文件未显示在我的应用程序中。我从here 尝试了不同的 mimeTypes 和不同的搜索参数。但它仅适用于在Dr.Edit 中创建的文件。问题是什么?

是否有任何其他参数可以帮助我显示Google Drive 中的所有文件。

【问题讨论】:

标签: objective-c ios mime-types google-drive-api


【解决方案1】:

改变了DrEditFilesListViewController.m的方法authButtonClicked的作用域

将此范围kGTLAuthScopeDriveFile 替换为kGTLAuthScopeDrive,如下所示

GTMOAuth2ViewControllerTouch *authViewController = 
  [[GTMOAuth2ViewControllerTouch alloc] initWithScope:**kGTLAuthScopeDriveFile**
                                             clientID:kClientId
                                         clientSecret:kClientSecret
                                     keychainItemName:kKeychainItemName
                                             delegate:self
                                     finishedSelector:finishedSelector];

GTMOAuth2ViewControllerTouch *authViewController = 
  [[GTMOAuth2ViewControllerTouch alloc] initWithScope:**kGTLAuthScopeDrive**
                                             clientID:kClientId
                                         clientSecret:kClientSecret
                                     keychainItemName:kKeychainItemName
                                             delegate:self
                                     finishedSelector:finishedSelector];

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多