title: Upload file to Google Drive with apiKey on ios
body: <p>I'm trying to upload an image to Google Drive to my own account (not user account) so I don't need to ask for permissions to the user. To do so I'm using the apiKey instead of oAuth2 method.
  The problem is that when I'm sending the file to Google the error I get is 'Login required' but I want to log in, that's why I use apiKey.</p>
  
  <pre><code>GTLServiceDrive *driveService = [[GTLServiceDrive alloc] init];
  [driveService setAPIKey:@"this-Is-My-APIKey"];
  NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
  [dateFormat setDateFormat:@"'Quickstart Uploaded File ('EEEE MMMM d, YYYY h:mm a, zzz')"];
  
  GTLDriveFile *file = [GTLDriveFile object];
  file.title = [dateFormat stringFromDate:[NSDate date]];
  file.descriptionProperty = @"Uploaded from the Google Drive iOS Quickstart";
  file.mimeType = @"image/png";
  
  NSData *data = UIImagePNGRepresentation([UIImage imageNamed:@"this-Is-My-Image"]);
  GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:data MIMEType:file.mimeType];
  GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file uploadParameters:uploadParameters];
  GTLServiceTicket *queryTicket =
  [driveService executeQuery:query
      completionHandler:^(GTLServiceTicket *ticket,
                          GTLDriveFile *insertedFile, NSError *error) {
          if (error == nil) {
              // Uncomment the following line to print the File ID.
               NSLog(@"File ID: %@", insertedFile.identifier);
          } else {
              NSLog(@"An error occurred: %@", error);
          }
      }];
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>An error occurred: Error Domain=com.google.GTLJSONRPCErrorDomain Code=401 "The operation couldn’t be completed. (Login Required)" UserInfo=0x7ffa12d14eb0 {error=Login Required, NSLocalizedFailureReason=(Login Required), GTLStructuredError=GTLErrorObject 0x7ffa12d2d8a0: {message:"Login Required" data:[1] code:401}}
  </code></pre>
  
  <p>Makes any sense what I'm trying to do? Any help will be welcome, thanks!!</p>