无需登录即可访问谷歌驱动器中公开共享的文件夹文件

时间:2016-12-09 10:31:51

标签: ios google-api google-drive-api google-oauth

我有一个要求,即用户将在谷歌驱动器的文件夹中上传音乐文件并将其公开。

所有其他用户无需登录即可下载/查看文件" Google Drive"作为公众。

我使用下面的代码从共享文件夹ID

获取文件列表
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q =[NSString stringWithFormat:@"'%@' in parents and trashed=false", folderId];

self.driveService = [[GTLServiceDrive alloc] init];

[self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,GTLDriveFileList *files, NSError *error)
{
        if (error == nil)
        {
          NSLog(@"Files==%@",files.items);
        }
        else
        {
          NSLog(@"An error occurred: %@", error);
        }
 }];

但是获得错误"超出未经身份验证的使用的每日限制。继续使用需要注册。"

如果文件夹已公开,那么为什么需要登录?

1 个答案:

答案 0 :(得分:0)

Google changed somethings about a year ago they want you to always identify your application even if you are requesting public data. If you don't identify your application you get lumped into a huge pool of other people not identifying their application and you all run under the same quota. As you can guess this quota gets used up quite fast I suspect Google has forced it to be very low to force us to identify our applications

Applying a public API key will inform Google that its your application making the request and you wont have to worry about any quota other then the main drive quota.

Set the per user quota as high as you can in Google developer console I cant remember how high you can set it.

I am not an IOS developer so cant help with any code on how to apply a API key to your request.

相关问题