Google云端硬盘上传API错误

时间:2013-02-20 12:13:22

标签: objective-c google-drive-api google-api-objc-client

我正在通过Objective-C SDK将图片上传到Google云端硬盘,今天早上我在上传完成后不断收到此错误:

2013-02-20 13:07:30.565转移[1774:907]< 0x1fab2b40 GDriveDataSource.m:(165)>发生错误:错误Domain = com.google.GTLJSONRPCErrorDomain Code = 400“无法完成操作。(不支持的内容类型为:application / json-rpc; charset = utf-8)” UserInfo = 0x1fcc0690 {error =不支持的内容类型为:application / json-rpc; charset = utf-8,GTLStructuredError = GTLErrorObject 0x1fcbfcc0:{message:“不支持的内容类型:application / json-rpc; charset = utf-8”代码:400 data:[1]},NSLocalizedFailureReason =(不支持的内容类型: application / json-rpc; charset = utf-8)}

我的代码已经工作了很多天,我最近没有改变。我肯定在upload parameters参数上设置了正确的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
                                                   uploadParameters:uploadParameters];

谢谢!

1 个答案:

答案 0 :(得分:0)

似乎这只是Google云端硬盘后端的临时问题,现在问题已解决,并且通过Objective-c sdk上传到GDrive再次正常运行。