Andrew Lai Andrew Lai - 6 months ago 37
iOS Question

rootFolderId not available in new SDK

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;
}];

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

        ////////////////////////////////////////////////////////////////////////////////////////////////////
        GTLServiceTicket *fileListTicket = [[GTLServiceDrive sharedServiceDrive] executeQuery:fileListQuery
                                                                            completionHandler:^(GTLServiceTicket *ticket,
                                                                                                GTLDriveFile *fileList,
                                                                                                NSError *fileListError)

from Google Drive API Says, The root folder for every user is identified by the alias root. This alias can be used to identify the root folder anywhere a file or folder ID is expected. https://developers.google.com/drive/ios/devguide/folders

Comments