根据 GTLQueryDrive.h 方法文档:
// Method: drive.files.list
// Lists the user's files.
// Optional:
// q: Query string for searching files.
// Fetches a GTLDriveFileList.
+ (id)queryForFilesList;
也在这里:https://developers.google.com/drive/search-parameters 示例标题下的第二项:
Search for folders using the folder-specific MIME type
mimeType = 'application/vnd.google-apps.folder'
当我执行 aqueryForFilesList
和 setq
时,我得到一个非错误结果,但 GTLFileList 的内容只有两个属性集,kind
和etag
. 结果中没有返回任何其他内容。见下文:
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = @"mimeType='application/vnd.google-apps.folder'";
[self.fileChecker executeQuery:query completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
if (!error) {
//I see this in the console...
//No Errors in Folder Query:
//GTLDriveFileList 0x108f3430: {kind:"drive#fileList"
//etag:""Q5ElJByAJoL0etObruYVPRipH1k/vyGp6PvFo4RvsFtPoIWeCReyIC8""}
NSLog(@"No Errors in Folder Query: %@",object);
GTLDriveFileList *list = (GTLDriveFileList *)object;
//So, none of this for() loop happens
for (GTLDriveFile *file in list.items) {
NSLog(@"Folder: \n \n %@ \n \n",file);
}
} else {
NSLog(@"Folder Query Error: %@",error);
}
}];
有什么我做错了吗?iOS Google Drive 应用绝对可以找到文件夹列表。我究竟做错了什么?