IOS: How to upload a file to specific Google drive folder using Google drive sdk library

后端 未结 3 859
青春惊慌失措
青春惊慌失措 2020-12-31 19:51

I integrated Google drive sdk with my iOS app. But I do not know how to upload a file to Google drive specific folder.

Here the code am using to upload the file. Bu

3条回答
  •  时光说笑
    2020-12-31 20:49

    GTLServiceTicket *_editFileListTicket;

        GTLServiceDrive *service = self.driveService;
    
        GTLDriveFile *folderObj = [GTLDriveFile object];
    
        folderObj.title = [NSString stringWithFormat:@"%@", title];
    
        folderObj.mimeType = @"application/vnd.google-apps.folder";
    
        GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:folderObj
                                                           uploadParameters:nil];
        _editFileListTicket = [service executeQuery:query
                                  completionHandler:^(GTLServiceTicket *ticket,
                                                      GTLDriveFile *folderItem,
                                                      NSError *error) {
    
                                     if (error == nil)
                                     {
    
                                         UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:@"Created" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                                         [alert show];
    
    
                                        }
                                     else
                                     {
    
                                         NSLog(@"error");
    
                                      }
                                  }];
    

提交回复
热议问题