gpt4 book ai didi

ios - 在 CrEdit 中列出来自 Google Drive 的所有文件和文件夹

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:54:27 24 4
gpt4 key购买 nike

我知道这个问题是 ( Listing All Folder content from Google Drive ),但我没有找到答案。我也有同样的问题。如果我将文件上传到谷歌驱动器,我无法在列表中找到它。只有我在 DrEdit 中创建的文件。我尝试将范围更改为 kGTLAuthScopeDrive 并将 mimeTipe 更改为“.”和所有“application/vnd.google-apps.”。我下载了 DrEdit,在 google drive console 上创建了我的应用程序,获得了客户端 ID 和客户端密码,在 DrEdit 中替换了它们,一切正常。我可以创建文件并在我的驱动器根文件夹中检查它。我手动将一些文件上传到根文件夹,然后在 init authViewController 中将范围更改为 kGTLAuthScopeDrive,将 mimeType = 'text/plain' 更改为 mimeType = '/*' 或其他类型。我错过了什么?请帮我。

最佳答案

如果您想列出来自谷歌驱动器的所有文件和文件夹,请使用此方法。

-(void)loadDriveFiles
{
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = [NSString stringWithFormat:@"'%@' IN parents", @"root"];
[self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
GTLDriveFileList *files,
NSError *error) {
if (error == nil)
{
driveFiles = [[NSMutableArray alloc] init]; //
[driveFiles addObjectsFromArray:files.items];

for (GTLDriveFile *file in driveFiles)
NSLog(@"File is %@", file.title);
}
else
{
NSLog(@"An error occurred: %@", error);
}
}];
}

对于 Mime 类型,请引用此内容,并在使用 or 运算符的查询中使用它。

example- GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = @" mimeType ='audio/mpeg' or mimeType ='audio/wav' or mimeType ='audio/aac' or mimeType ='audio/aiff' or mimeType = 'video/mp4' or mimeType = 'image/png' or mimeType = 'application/zip' ";

可用的 Mime 类型-

$mime_types= array(
"xls" =>'application/vnd.ms-excel',
"xlsx" =>'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
"xml" =>'text/xml',
"ods"=>'application/vnd.oasis.opendocument.spreadsheet',
"csv"=>'text/plain',
"tmpl"=>'text/plain',
"pdf"=> 'application/pdf',
"php"=>'application/x-httpd-php',
"jpg"=>'image/jpeg',
"png"=>'image/png',
"gif"=>'image/gif',
"bmp"=>'image/bmp',
"txt"=>'text/plain',
"doc"=>'application/msword',
"js"=>'text/js',
"swf"=>'application/x-shockwave-flash',
"mp3"=>'audio/mpeg',
"zip"=>'application/zip',
"rar"=>'application/rar',
"tar"=>'application/tar',
"arj"=>'application/arj',
"cab"=>'application/cab',
"html"=>'text/html',
"htm"=>'text/html',
"default"=>'application/octet-stream',
"folder"=>'application/vnd.google-apps.folder'
);

关于ios - 在 CrEdit 中列出来自 Google Drive 的所有文件和文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20391734/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com