jeudi 13 août 2015

Google Drive API IOS

First, I have implemented a GTMOAuth that asks the user for KGTLAuthScopeDriveMetadata. That functions correctly.

So I am able to get a list of files by providing a folder id following this code: http://ift.tt/1zCF6rB

- (void)loadDriveFiles {
  GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
  query.q = @"mimeType = 'text/plain'";

  UIAlertView *alert =
      [DrEditUtilities showLoadingMessageWithTitle:@"Loading files"
                                          delegate:self];
  [self.driveService executeQuery:query
                completionHandler:^(GTLServiceTicket *ticket,
                                    GTLDriveFileList *files,
                                    NSError *error) {
      [alert dismissWithClickedButtonIndex:0 animated:YES];
      if (!error) {
        self.driveFiles = [files.items mutableCopy];
        [self.tableView reloadData];
      } else {
        NSLog(@"An error occurred: %@", error);
        [DrEditUtilities showErrorMessageWithTitle:@"Unable to load files"
                                           message:[error description]
                                          delegate:self];
      }
  }];
}

So now when I try to download one of those files, none of the gtldrivefiles have the property downloadurl. They do have webcontentlink, alternateurl. Thus I cannot download the file. I have followed this code: http://ift.tt/Q3fmNw to download a file, but as can be seen the property downloadurl is needed.

note that the types of files that do not have a downloadurl property is mp4, mov, jpg, etc.

any reason as to why i never get the downloadurl property?

Note: I do ask the user on login for full access to the drive.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire