相关疑难解决方法(0)

通过IOS Google Drive SDK列出Google云端硬盘中指定文件夹中的所有文件

实际上我将google drive sdk与我的ios应用程序集成在一起.我可以通过谷歌驱动器ios sdk检索/上传谷歌驱动器中的文件.但是从指定的父文件夹中检索文件列表需要花费很多时间.

这里是我正在使用的步骤和代码.

首先获取指定父文件夹的子项,然后获取每个子项的GTLDriveChildReference,然后使用子引用标识符进行查询.

这对我来说是一个巨大的过程.此外,它每次都要求谷歌服务器.有更好的方法可以在查询中传递父文件夹ID并从该父文件夹中提取文件.

   -(void)getFileListFromSpecifiedParentFolder {
        GTLQueryDrive *query2 = [GTLQueryDrive queryForChildrenListWithFolderId:<some_id or root>];
        query2.maxResults = 1000;

        // queryTicket can be used to track the status of the request.
        [self.driveService executeQuery:query2
            completionHandler:^(GTLServiceTicket *ticket,
                            GTLDriveChildList *children, NSError *error) {
                NSLog(@"\nGoogle Drive: file count in the folder: %d", children.items.count);
                //incase there is no files under this folder then we can avoid the fetching process
                if (!children.items.count) {
                    return ;
                }

                if (error == nil) {
                    for (GTLDriveChildReference *child …
Run Code Online (Sandbox Code Playgroud)

ios google-drive-api google-api-objc-client

2
推荐指数
1
解决办法
4316
查看次数

列出Google云端硬盘的所有文件夹内容

嗨我已经使用谷歌驱动的博士编辑示例代码将谷歌潜水与我的应用程序集成.但我无法查看存储在Google云端硬盘帐户中的所有文件.

//我试过这个

-(void)getFileListFromSpecifiedParentFolder 
{
GTLQueryDrive *query2 = [GTLQueryDrive queryForChildrenListWithFolderId:@"root"];
query2.maxResults = 1000;


[self.driveService executeQuery:query2
              completionHandler:^(GTLServiceTicket *ticket,
                                  GTLDriveChildList *children, NSError *error) 
{
 NSLog(@"\nGoogle Drive: file count in the folder: %d",   children.items.count);

if (!children.items.count) 
{
    return ;
}

if (error == nil) 
{
for (GTLDriveChildReference *child in children) 
{

GTLQuery *query = [GTLQueryDrive queryForFilesGetWithFileId:child.identifier];
[self.driveService executeQuery:query                          completionHandler:^(GTLServiceTicket *ticket,
                             GTLDriveFile *file,
                             NSError *error) 
{
NSLog(@"\nfile name = %@", file.originalFilename);}];
                      }
                  }
              }];
 }
Run Code Online (Sandbox Code Playgroud)

//我想显示NSLog中的所有内容...

iphone objective-c ios google-drive-api

0
推荐指数
1
解决办法
3788
查看次数