3
votes

I am working in an application and trying to adding Google API to use Google drive where user can store/share my application files. I found good tutorial for that Google Drive tutorial I downloaded the sample code worked on it, I downloaded the code yesterday it was working good the files are storing as expected, Today agin I am checking, every time I am getting error meesage. please find the console message

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=0x75b11f0 {error=Unsupported content with type: application/json-rpc; charset=utf-8, GTLStructuredError=GTLErrorObject 0x75a3f90: {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)}

can some one suggest me the alternative to integrate the Google drive in iOS app.

if this is happen with the sample code it self how could be the Google API for iOS reliable to integrate in our apps.

Note: I created the kClientSecret and kClientId also to use DrEdit sample code given by the Google.

1
I dont know what is the wrong in this question..It would be great, people vote down for a question by giving some comment where the mistaken by the question owner. - ajay

1 Answers

2
votes

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.

To make the sample that ships with the SDK work, open DriveWindowController.m and in the "uploadFileAtPath:" method under "newFile.title = filename;" add "newFile.mimeType = @"image/png";". Change "image/png" to the MIME type of the file you are uploading.

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

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