rootFolderId not available in new SDK

时间:2016-05-17 11:07:59

标签: ios objective-c google-drive-api

In my Code, I need this property to do something. Have another way to get this information?

GTLServiceTicket *aboutGetTicket = [[GTLServiceDrive sharedServiceDrive] executeQuery:aboutGetQuery
                                                                            completionHandler:^(GTLServiceTicket *ticket, GTLDriveAbout *about, NSError *aboutError)
                                            {   
                                               if(about.rootFolderId!=nil)

                                                    {
                                                        NSArray *filesForPath = [GTLServiceDrive filesForPathComponents:pathComponents
                                                                                                 currentPathComponentID:about.rootFolderId
                                                                                                                  error:error];
                                                        if(*error==nil)
                                                        {
                                                            [files addObjectsFromArray:filesForPath];
                                                        }
                                                    }
                                                }

                                                executing = NO;
                                            }];

1 个答案:

答案 0 :(得分:1)

GTLQueryDrive *fileListQuery = [GTLQueryDrive queryForFilesGetWithFileId:@"root"];
        if(fileListQuery==nil)
        {
            break;
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////
        GTLServiceTicket *fileListTicket = [[GTLServiceDrive sharedServiceDrive] executeQuery:fileListQuery
                                                                            completionHandler:^(GTLServiceTicket *ticket,
                                                                                                GTLDriveFile *fileList,
                                                                                                NSError *fileListError)
来自Google Drive API的

说, 每个用户的根文件夹由别名根标识。此别名可用于在期望文件或文件夹ID的任何位置标识根文件夹。 https://developers.google.com/drive/ios/devguide/folders