LetItPig
LetItPig

Reputation: 41

Unable to list files within specific folders with Google Drive api v3 in iOS

I've been working in updating the Google Drive v2 api to v3 in a file explorer app for iOS and I'm finding quite difficult to list the immediate children within a specific folder.

I've find a few posts with the following code but it hasn't worked.

GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = [NSString stringWithFormat:@"%@ in parents", parentIdQuery ? : @"root"];

I have tried using the GTLDriveFile property identifierin parentIdQuery as well as the nameproperty.

When using the name property I receive the error

com.google.GTLJSONRPCErrorDomain Code=404 "(File not found: .)"

And when I use the identifier property I get the root file list every time I try to enter to a directory (I can do this over and over again). Besides that I get the list of all the files every time but not only the root immediate children.

I'll appreciate any guidance you guys can give me on this.

Thanks!

PD: I'm using the GTLCore project cloned from https://github.com/google/google-api-objectivec-client

Google's Drive api documentation wasn't helpful.

Upvotes: 3

Views: 542

Answers (1)

LetItPig
LetItPig

Reputation: 41

It was a problem with the query indeed, the query.q string I posted had the string and mimeType = 'image/jpg' or mimeType = 'application/vnd.google-apps.folder' concatenated later in the code instead of and (or mimeType = 'image/jpg' or mimeType = 'application/vnd.google-apps.folder') and i haven't noticed.

Thanks sept for your answer!

Upvotes: 1

Related Questions