Google Drive upload API error

2019-06-21 07:27发布

问题:

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!

回答1:

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.