Mor*_*ang 2 objective-c ios mime-types google-drive-api
我正在尝试将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,
...
}
Run Code Online (Sandbox Code Playgroud)
现在我想知道如何下载具有不同文件扩展名的用户文件夹中的所有文件,例如pdf,doc等...
如何在用户google云端硬盘帐户中显示/列出所有文档?
两件事情:
1)空查询似乎返回所有文件:
query.q = @"";
Run Code Online (Sandbox Code Playgroud)
2)确保您请求访问auth中的所有文件(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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2246 次 |
| 最近记录: |