Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting Files fails with assertion #19

Closed
GoogleCodeExporter opened this issue Apr 30, 2015 · 1 comment
Closed

Deleting Files fails with assertion #19

GoogleCodeExporter opened this issue Apr 30, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run the Drive Sample Application and attempt to delete a file after signing 
in

Expected results:
File is deleted and query callback occurs displaying an alert informing that 
the file has been deleted

Actual results:
File is deleted remotely and assertion occurs in the code:    GTL_ASSERT([json 
count] != 0, @"Creating object from empty json");

What version of the product are you using? build from 6-Aug-2012
On what operating system? OSX Lion

Apparently, the drive server used to return no data when deleting a file, but 
now it returns JSON with an empty results array.  This breaks the code.  

A fix is below:
in GTLService.m parseObjectyFromDataOfFetcher:

      //DEFECT WORKAROUND FOR GTLSERVICE - Google API now does return JSON data for deletes, but the JSON array for result is blank.  Check json count and ignore if empty
      if (json != nil && [json count]>0) {
...
      } else if (!isREST) {
        NSMutableDictionary *errorJSON = [jsonWrapper valueForKey:@"error"];
          //DEFECT WORKAROUND PART 2:  Don't assert on no error due to the situation described above.  
          if(errorJSON!=nil){
              GTL_DEBUG_ASSERT(errorJSON != nil, @"no result or error in response:\n%@",
                         jsonWrapper);
              GTLErrorObject *errorObject = [GTLErrorObject objectWithJSON:errorJSON];
              NSError *error = [errorObject foundationError];

              // Store the error and let it go to the callback
              [properties setValue:error
                      forKey:kFetcherFetchErrorKey];
          }
        }
    }

Original issue reported on code.google.com by joels...@gmail.com on 10 Sep 2012 at 10:20

@GoogleCodeExporter
Copy link
Author

Thanks for reporting this issue. A fix was submitted on Sept 10.

https://code.google.com/p/google-api-objectivec-client/source/detail?r=207

Original comment by grobb...@google.com on 13 Sep 2012 at 9:56

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant