我正在通过 Objective-C SDK 将图像上传到谷歌驱动器,今天早上上传完成后我不断收到此错误:
2013-02-20 13:07:30.565 Transfer[1774:907] <0x1fab2b40 GDriveDataSource.m:(165)> 发生错误:Error 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:"Unsupported content with type: application/json-rpc; charset=utf-8" code:400 data:[1]}, NSLocalizedFailureReason=(Unsupported content with type:应用程序/json-rpc;字符集=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
uploadParameters:uploadParameters];
谢谢!