Reputation: 429
I'm trying to get a public url that can be accessed anywhere for streaming. I can get the downloadUrl
, but doing the same for exportLinks
results in null values. The code for this is below, though I don't know what my problem is.
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
This is only a snippet of the code, so if I need to show more, just ask.
Upvotes: 8
Views: 2292
Reputation: 22296
A file will either have a downloadUrl or a set of exportLinks. Not both. exportLinks is for converting native Google docs into a PC format (eg Google spreadsheet to .xls).
I think webContentLink may be the property you need to use.
Upvotes: 0
Reputation: 5128
From google-api-objectivec-client go to DriveSampleWindowController.m,
check the method called - (void)downloadFormatSelected:(NSMenuItem *)menuItem
where its shown cleary how to format the exportLinks
.
NSLog(@"%@",[file.exportLinks JSONValueForKey:@"urtitlekey"]);
This is what you wanted.Hope it helps.
Upvotes: 5