我正在使用google drive API更新存储在Google云端硬盘上的某些文件的缩略图。
GTLRDrive_File *update = [ GTLRDrive_File object ];
update.contentHints = [ GTLRDrive_File_ContentHints object ];
update.contentHints.thumbnail = [ GTLRDrive_File_ContentHints_Thumbnail object ];
update.contentHints.thumbnail.mimeType = @"image/png";
update.contentHints.thumbnail.image = base64UrlEncodedImage;
GTLRDriveQuery_FilesUpdate *query =
[ GTLRDriveQuery_FilesUpdate queryWithObject:update
fileId:metadata.identifier
uploadParameters:NULL ];
query.fields = uploadFileFieldsParam;
[ [ GoogleDriveConnector googleDriveService ]
executeQuery:query
completionHandler:^(GTLRServiceTicket *ticket, GTLRDrive_File *updatedMetadata,NSError *error)
查询正确执行。 HTTP返回200 OK。在响应上返回fileId和其他字段。但是当我在Google云端硬盘上看到该文件时,其缩略图的网址无效(使用另一个标签上的打开图片) - https://lh3.googleusercontent.com/GlnPfIj_tU1McaUy9sTyUOzavxIFbj- ..... 如果我单击此URL,它将显示非常有用的404.在此服务器上找不到请求的URL。这就是我们所知道的。
如果我将base64UrlEncodedImage URL复制到API控制台并执行查询,则缩略图生成正常。我能看到的唯一区别是,当控制台使用https://www.googleapis.com/drive/v3/files时,会话提取器正在使用https://content.googleapis.com/drive/v3/files/。这两个网址都没有上传前缀。
我是否需要将uploadParameters传递给queryWithObject,即使没有上传文件,也只是其缩略图。
有关如何本地化/调试此方法的任何指导或提示都会有所帮助。