2012-10-18 67 views
3

我正在尝试整合Google Drive Api for IOS。当他们上传或下载他们使用MIME类型文件我测试的示例程序here如何获取Google Drive API IOS文件列表?

DrEdit比如当他们上传文件

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

当API下载同一个文件,它使用

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

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

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

+1

也许你打错范围:https://开头开发商.google.com/drive/scopes – DavidVdd

+0

是的,你是对的。我改变了(IBAction)authButtonClicked [[GTMOAuth2ViewControllerTouch alloc] initWithScope:从kGTLAuthScopeDriveFile改为kGTLAuthScopeDrive,效果很好。 GTLDriveConstats.m中有常量//授权范围 NSString * const kGTLAuthScopeDrive = @“https://www.googleapis.com/auth/drive”; NSString * const kGTLAuthScopeDriveAppsReadonly = @“https://www.googleapis.com/auth/drive.apps.readonly”; NSString * const kGTLAuthScopeDriveFile = @“https://www.googleapis.com/auth/drive.file”; 等。感谢帮助。 – user1755343

回答

6

改变范围在DrEditFilesListViewController.m

方法authButtonClickedkGTLAuthScopeDrive替换此范围kGTLAuthScopeDriveFile如下

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]; 
+1

请编辑您的答案并对代码进行格式化以使其可读。 – kleopatra

+0

容易忽略,谢谢你。 – jarryd

+0

+1 ...为什么不是这个被接受的答案? – TheTiger

相关问题