ios - Assertion failure in GTMHTTPUploadFetcher connectionDidFinishLoading -


i'm having trouble uploading file google drive. followed instructions , i'm able login , authenticate user, when go upload file hit following assertion:

* assertion failure in -[gtmhttpuploadfetcher connectiondidfinishloading:], /users/.../google-api-objectivec-client-read-only/source/httpfetcher/gtmhttpuploadfetcher.m:399

i double checked , made sure -objc -all_load in other linker flags.

here code i'm using, copy of google using in sample.

nsarray *paths = nssearchpathfordirectoriesindomains (nsdocumentdirectory, nsuserdomainmask, yes); nsstring *localpath = [paths objectatindex:0]; nsstring *filepath = [nsstring stringwithformat:@"%@/%@",                       localpath,filenamestring];  nsdata *myfiledata = [nsdata datawithcontentsoffile:filepath];  gtldrivefile *file = [gtldrivefile object]; file.title = filenamestring; file.descriptionproperty = filenamestring; file.mimetype = @"application/pdf";  gtluploadparameters *uploadparameters = [gtluploadparameters                                          uploadparameterswithdata:myfiledata                                          mimetype:@"application/pdf"];  gtlquerydrive *query = [gtlquerydrive queryforfilesinsertwithobject:file                                                    uploadparameters:uploadparameters];  [self.driveservice executequery:query               completionhandler:^(gtlserviceticket *ticket,                                   gtldrivefile *updatedfile,                                   nserror *error) {                   if (error == nil) {                       nslog(@"file uploaded");                   } else {                       nslog(@"upload failed");                               }               }]; 

here code highlighted when assertion occurs:

  // initial response of resumable upload protocol should have   // empty body   //   // assert typically happens because upload create/edit link url   // not supplied request, , server expecting non-   // resumable request/response.   nsassert([[self downloadeddata] length] == 0,                     @"unexpected response data (uploading wrong url?)"); 

does know url referring to? haven't seen url being used uploading new file anywhere.

found problem. need enable drive api , drive sdk api console/services tab. here's post helped:

google drive http 403 "access not configured" error dredit


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -