Google云端硬盘上传API错误 [英] Google Drive upload API error
问题描述
2013-02- 20 13:07:30.565传输[1774:907]< 0x1fab2b40 GDriveDataSource.m:(165)>发生错误:错误域= com.google.GTLJSONRPCErrorDomain代码= 400操作无法完成。 >类型不受支持的内容:application / json-rpc; charset = utf-8)UserInfo = 0x1fcc0690 {error =不支持的内容类型为application / json-rpc; charset = utf-8,GTLStructuredError = GTLErrorObject 0x1fcbfcc0:{message:Unsupported content with type:application / json-rpc; charset = utf-8code:400 data:[1]},NSLocalizedFailureReason =(Unsupported content with type: application / json-rpc; charset = utf-8)}
我的代码已经工作了很多天了,而且我最近没变。我肯定在上传参数参数上设置了正确的MIME类型。以下是代码的相关部分:
GTLDriveFile * file = [GTLDriveFile object];
file.title = asset.fileName;
file.mimeType = @image / jpeg;
NSData * imageData = [asset getImageDataForResolutionType:resType];
GTLUploadParameters * uploadParameters = [GTLUploadParameters uploadParametersWithData:imageData
MIMEType:file.mimeType];
GTLQueryDrive * query = [GTLQueryDrive queryForFilesInsertWithObject:file $ b $ uploadParameters:uploadParameters];
谢谢!
似乎这只是Google Drive后端的暂时问题,现在问题已解决,并且通过Objective-c sdk上载到GDrive的功能又一次起作用。
I'm uploading an image to google drive via the Objective-C SDK and this morning I keep getting this error after the upload completes:
2013-02-20 13:07:30.565 Transfer[1774:907] <0x1fab2b40 GDriveDataSource.m:(165)> An error occurred: Error Domain=com.google.GTLJSONRPCErrorDomain Code=400 "The operation couldn’t be completed. (Unsupported content with type: application/json-rpc; charset=utf-8)" UserInfo=0x1fcc0690 {error=Unsupported content with type: application/json-rpc; charset=utf-8, GTLStructuredError=GTLErrorObject 0x1fcbfcc0: {message:"Unsupported content with type: application/json-rpc; charset=utf-8" code:400 data:[1]}, NSLocalizedFailureReason=(Unsupported content with type: application/json-rpc; charset=utf-8)}
My code has been working for many days and I haven't changed recently. I'm definitely setting the right mime type on the upload parameters parameter. Here is the relevant part of the code:
GTLDriveFile *file = [GTLDriveFile object];
file.title = asset.fileName;
file.mimeType = @"image/jpeg";
NSData *imageData = [asset getImageDataForResolutionType:resType];
GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:imageData
MIMEType:file.mimeType];
GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file
uploadParameters:uploadParameters];
Thanks!
Seems like this was just a temporary issue with the Google Drive backend, the issue is now resolved and the uploads to GDrive via the Objective-c sdk are functional again.
这篇关于Google云端硬盘上传API错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!