【发布时间】: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 中的所有文件。
【问题讨论】:
-
可能你的范围有误:developers.google.com/drive/scopes
-
是的,你是对的。我已将 (IBAction)authButtonClicked [[GTMOAuth2ViewControllerTouch alloc] initWithScope: 从 kGTLAuthScopeDriveFile 更改为 kGTLAuthScopeDrive 并且效果很好。 GTLDriveConstats.m 中有常量 // 授权范围 NSString * const kGTLAuthScopeDrive = @"googleapis.com/auth/drive"; NSString * const kGTLAuthScopeDriveAppsReadonly = @"googleapis.com/auth/drive.apps.readonly"; NSString * const kGTLAuthScopeDriveFile = @"googleapis.com/auth/drive.file";和别的。感谢您的帮助。
标签: objective-c ios mime-types google-drive-api