Reputation: 2230
I wanna get the folder's id use folder's title in google drive,so I use objc to execute a query.Like these codes:
-(void)startrestore
{
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = @"title='hello' and mimeType='application/vnd.google-apps.folder'";
[service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, GTLDriveFileList *files,
NSError *error) {
NSLog(@"4");
if (error == nil) {
NSString *array = files.JSONString;
NSLog(@"%@",array);
} else {
NSLog(@"An error occurred: %@", error);
}
}];
}
But the response is:
{
"kind" : "drive#fileList",
"etag" : "\"KYLl3b7q6n8KW2kbVvK9NFUdVkc\/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
}
If I change the code like this:
query.q = @"title='picture.jpg' and mimeType='image/jpeg'";
the response is:
{
"kind" : "drive#fileList",
"etag" : "\"KYLl3b7q6n8KW2kbVvK9NFUdVkc\/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
}
Why?
Upvotes: 1
Views: 170
Reputation: 2230
Oh I am foolish,I fixed it up,we should use the scope kGTLAuthScopeDrive rather than the scope kGTLAuthScopeDriveFile.
Upvotes: 1