如何获取Google云端硬盘文件的公开网址?

Nex*_*tep 7 iphone objective-c ios google-drive-api

我正在尝试获取一个可以在任何地方访问流媒体的公共URL.我可以得到downloadUrl,但对于exportLinksnull值的结果也一样.这个代码如下,但我不知道我的问题是什么.

NSError *error;
NSString *exportURLStr;  
GTLDriveFile *file = [driveFiles objectAtIndex:indexPath.row];
exportURLStr = [NSString stringWithFormat:@"%@",file.exportLinks];  
NSURL *url = [NSURL URLWithString:exportURLStr];
NSString *temp1= [NSString stringWithFormat:@"%@",url];

// NSLog of temp1 is Null
// I tried with file.WebContentLink  but getting 404 Error
Run Code Online (Sandbox Code Playgroud)

这只是代码片段,所以如果我需要表现出更多的,只问.

Mas*_*oke 5

google-api-objectivec-client转到DriveSampleWindowController.m,

检查调用方法所- (void)downloadFormatSelected:(NSMenuItem *)menuItem显示的如何格式化exportLinks.

 NSLog(@"%@",[file.exportLinks JSONValueForKey:@"urtitlekey"]); 
Run Code Online (Sandbox Code Playgroud)

这就是你想要的.希望它有所帮助.