Here is my code .
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) {
if (self.driveFiles == nil) {
self.driveFiles = [[NSMutableArray alloc] init];
}
[self.driveFiles removeAllObjects];
[self.driveFiles addObjectsFromArray:files.items];
[tbDownload reloadData];
}
else
{
NSLog(@"An error occurred: %@", error);
}
}];
I'm getting the error by using this code .
n error occurred: Error Domain=com.google.GTLJSONRPCErrorDomain Code=401 "The operation couldn’t be completed. (Login Required)" UserInfo=0x8f72a40 {error=Login Required, GTLStructuredError=GTLErrorObject 0x8f647a0: {message:"Login Required" code:401 data:[1]}, NSLocalizedFailureReason=(Login Required)}
I Already login with google drive in my app .
You probably aren't configuring your
GTLServiceDrive
with theGTMOAuth2Authentication
instance you get after successful authentication.Example code: