Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while uploading file to Google Drive

I have implement Google Drive SDK in my app project. and try to upload an image in Google Drive But I got Error.

I do code from Here

when i run this code I got Below Error

Error Domain=com.google.GTLJSONRPCErrorDomain Code=400 "The operation couldn’t be completed. (Invalid Value)" UserInfo=0x276940 {NSLocalizedFailureReason=(Invalid Value), GTLStructuredError=GTLErrorObject 0x2fade0: {message:"Invalid Value" code:400 data:[1]}, error=Invalid Value}

please give me suggestion for this. Thanks in advance

like image 362
Pratik Avatar asked Oct 22 '22 12:10

Pratik


1 Answers

HI pratik i just google it and got some solution it might be it helps you. This Error occur becouse you are not set proparly image mimeType or Name.

Very recent changes in the Google Drive service obliges you to specify a mime type different than "application/json-rpc" when uploading a file. This mime type is used by default when using the ObjectiveC SDK, so you need to specify one.

GTLDriveFile *newFile = [GTLDriveFile object];
newFile.title = filename;
newFile.mimeType = @"image/png";

Edited: It also seems that there is temporary problem on Google's servers

source from:- Google drive integration in iOS giving error while calling insert

ans also it Seems like this was just a temporary issue with the Google Drive backend.

like image 93
Nitin Gohel Avatar answered Oct 30 '22 23:10

Nitin Gohel