How to get url to google drive file from GTLDriveF

2019-05-23 15:21发布

问题:

In old version of the Google Drive API v2 a fileresource contained was alternateUrl which could be used to point to the file in browser. In latest version of Google Drive v3 a fileresource contains only webViewLink, but it's returned nil.

Maybe there is way to convert file identifier to url ?

Edit: As mentioned in similar question on stack overflow, the webViewLink is returned only for public folders. As a workaround i used for now:

[NSString stringWithFormat:@"https://drive.google.com/file/d/%@/view", file.identifier]

But not sure if this urls will be valid in future, perfectly google api would return something i could use to later open file in browser.

回答1:

in my app, my webViewLink have value! You must in query action add following codefileListQuery.fields = @"*";