{"action":"created","issue":{"url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/141","repository_url":"https://api.github.com/repos/google/google-api-objectivec-client","labels_url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/141/comments","events_url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/141/events","html_url":"https://github.com/google/google-api-objectivec-client/issues/141","id":129720053,"number":141,"title":"Can not get file list when root folder is empty","user":{"login":"maimuzo","id":13384,"avatar_url":"https://avatars.githubusercontent.com/u/13384?v=3","gravatar_id":"","url":"https://api.github.com/users/maimuzo","html_url":"https://github.com/maimuzo","followers_url":"https://api.github.com/users/maimuzo/followers","following_url":"https://api.github.com/users/maimuzo/following{/other_user}","gists_url":"https://api.github.com/users/maimuzo/gists{/gist_id}","starred_url":"https://api.github.com/users/maimuzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maimuzo/subscriptions","organizations_url":"https://api.github.com/users/maimuzo/orgs","repos_url":"https://api.github.com/users/maimuzo/repos","events_url":"https://api.github.com/users/maimuzo/events{/privacy}","received_events_url":"https://api.github.com/users/maimuzo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-01-29T09:58:15Z","updated_at":"2016-04-07T16:06:34Z","closed_at":null,"body":"I want to get file list from Google Drive on iOS.\r\nI can get file list on my app, but some times can not.\r\n\r\n\r\nTEST CASES\r\n\r\n1) I can get file list, after create \"folder1\" folder on Google Drive using browser.\r\n\r\n```\r\nvariable lookme = {\r\n\t\\\"id\\\":\\\"gtl_1\\\",\r\n\t\\\"result\\\":{\r\n\t\t\\\"files\\\":[\r\n\t\t\t{\r\n\t\t\t\t\\\"id\\\":\\\"0BwaR-JZbWW------mask-----WFSb1U\\\",\r\n\t\t\t\t\\\"name\\\":\\\"folder1\\\",\r\n\t\t\t\t\\\"mimeType\\\":\\\"application/vnd.google-apps.folder\\\",\r\n\t\t\t\t\\\"trashed\\\":false,\r\n\t\t\t\t\\\"webViewLink\\\":\\\"https://docs.google.com/folderview?id=0BwaR-JZbWW1G------mask-----1U&usp=drivesdk\\\",\r\n\t\t\t\t\\\"modifiedTime\\\":\\\"2016-01-29T06:48:01.298Z\\\",\r\n\t\t\t\t\\\"permissions\\\":[\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\\\"kind\\\":\\\"drive#permission\\\",\r\n\t\t\t\t\t\t\\\"id\\\":\\\"13133------mask-----1277\\\",\r\n\t\t\t\t\t\t\\\"type\\\":\\\"user\\\",\r\n\t\t\t\t\t\t\\\"emailAddress\\\":\\\"myaccount@gmail.com\\\",\r\n\t\t\t\t\t\t\\\"role\\\":\\\"owner\\\",\r\n\t\t\t\t\t\t\\\"displayName\\\":\\\"my account\\\"\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t]\r\n\t}\r\n}\r\n```\r\n\r\n2) I can get file list, after create \"folder1\" and \"folder2\" folders on Google Drive using browser.\r\n\r\n```\r\nvariable lookme = {\r\n\t\\\"id\\\":\\\"gtl_1\\\",\r\n\t\\\"result\\\":{\r\n\t\t\\\"files\\\":[\r\n\t\t\t{\r\n\t\t\t\t\\\"id\\\":\\\"0BwaR-JZbW------mask-----W8\\\",\r\n\t\t\t\t\\\"name\\\":\\\"folder2\\\",\r\n\t\t\t\t\\\"mimeType\\\":\\\"application/vnd.google-apps.folder\\\",\r\n\t\t\t\t\\\"trashed\\\":false,\r\n\t\t\t\t\\\"webViewLink\\\":\\\"https://docs.google.com/folderview?id=0BwaR-JZbWW1------mask-----W8&usp=drivesdk\\\",\r\n\t\t\t\t\\\"modifiedTime\\\":\\\"2016-01-29T06:48:07.792Z\\\",\r\n\t\t\t\t\\\"permissions\\\":[\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\\\"kind\\\":\\\"drive#permission\\\",\r\n\t\t\t\t\t\t\\\"id\\\":\\\"13133------mask-----1277\\\",\r\n\t\t\t\t\t\t\\\"type\\\":\\\"user\\\",\r\n\t\t\t\t\t\t\\\"emailAddress\\\":\\\"myaccount@gmail.com\\\",\r\n\t\t\t\t\t\t\\\"role\\\":\\\"owner\\\",\r\n\t\t\t\t\t\t\\\"displayName\\\":\\\"my account\\\"\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\\\"id\\\":\\\"0BwaR-JZb------mask-----FSb1U\\\",\r\n\t\t\t\t\\\"name\\\":\\\"folder1\\\",\r\n\t\t\t\t\\\"mimeType\\\":\\\"application/vnd.google-apps.folder\\\",\r\n\t\t\t\t\\\"trashed\\\":false,\r\n\t\t\t\t\\\"webViewLink\\\":\\\"https://docs.google.com/folderview?id=0BwaR-JZbW------mask-----1U&usp=drivesdk\\\",\r\n\t\t\t\t\\\"modifiedTime\\\":\\\"2016-01-29T06:48:01.298Z\\\",\r\n\t\t\t\t\\\"permissions\\\":[\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\\\"kind\\\":\\\"drive#permission\\\",\r\n\t\t\t\t\t\t\\\"id\\\":\\\"13133------mask-----277\\\",\r\n\t\t\t\t\t\t\\\"type\\\":\\\"user\\\",\r\n\t\t\t\t\t\t\\\"emailAddress\\\":\\\"myaccount@gmail.com\\\",\r\n\t\t\t\t\t\t\\\"role\\\":\\\"owner\\\",\r\n\t\t\t\t\t\t\\\"displayName\\\":\\\"my account\\\"\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t]\r\n\t}\r\n}\r\n```\r\n\r\n3) I can NOT get file list, after delete \"folder1\" and \"folder2\" on root folder and trash box on Google Drive using browser.\r\nin this case, root folder is empty.\r\n\r\n`variable lookme = {\\\"id\\\":\\\"gtl_1\\\"}`\r\n\r\nso, I made this monkey patch.\r\n\r\n```\r\ndiff --git a/Source/Objects/GTLService.m b/Source/Objects/GTLService.m\r\nindex f133218..219aa65 100644\r\n--- a/Source/Objects/GTLService.m\r\n+++ b/Source/Objects/GTLService.m\r\n@@ -27,6 +27,7 @@\r\n #endif\r\n \r\n #import \"GTLService.h\"\r\n+#import \"GTLServiceDrive.h\" // for checking\r\n \r\n NSString* const kGTLServiceErrorDomain = @\"com.google.GTLServiceDomain\";\r\n NSString* const kGTLJSONRPCErrorDomain = @\"com.google.GTLJSONRPCErrorDomain\";\r\n@@ -1240,6 +1241,10 @@ totalBytesExpectedToSend:(NSInteger)totalBytesExpected {\r\n           json = jsonWrapper;\r\n         } else {\r\n           json = [jsonWrapper valueForKey:@\"result\"];\r\n+//            NSString* lookme = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\r\n+            if(nil == json && [ticket.service isKindOfClass:[GTLServiceDrive class]] && [((GTLQuery*)ticket.executingQuery).methodName isEqualToString:@\"drive.files.list\"]){\r\n+                json = [@{@\"files\":@[]} mutableCopy];\r\n+            }\r\n         }\r\n       }\r\n\r\n```\r\n\r\n\r\n\r\nMy problem is solved by my patch, but I think this problem is more commonly.\r\n\r\nAND\r\n\r\nI have seen next pattern:\r\n\t\r\n```\r\n{\r\n\t\\\"id\\\":\\\"gtl_3\\\",\r\n\t\\\"result\\\":{\r\n\t\t\\\"kind\\\":\\\"drive#file\\\",\r\n\t\t\\\"id\\\":\\\"0BwaR-J------mask-----mpSMjA\\\",\r\n\t\t\\\"name\\\":\\\"foldername\\\",\r\n\t\t\\\"mimeType\\\":\\\"application/vnd.google-apps.folder\\\"\r\n\t}\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/comments/206971628","html_url":"https://github.com/google/google-api-objectivec-client/issues/141#issuecomment-206971628","issue_url":"https://api.github.com/repos/google/google-api-objectivec-client/issues/141","id":206971628,"user":{"login":"thomasvl","id":5279928,"avatar_url":"https://avatars.githubusercontent.com/u/5279928?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasvl","html_url":"https://github.com/thomasvl","followers_url":"https://api.github.com/users/thomasvl/followers","following_url":"https://api.github.com/users/thomasvl/following{/other_user}","gists_url":"https://api.github.com/users/thomasvl/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasvl/subscriptions","organizations_url":"https://api.github.com/users/thomasvl/orgs","repos_url":"https://api.github.com/users/thomasvl/repos","events_url":"https://api.github.com/users/thomasvl/events{/privacy}","received_events_url":"https://api.github.com/users/thomasvl/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T16:06:34Z","updated_at":"2016-04-07T16:06:34Z","body":"Ok, this actually gets ugly if the fields filters away things, the current code path in Release would skip the assert and try to make an error object out of the nil error JSON."}}