- (void) searchRootFolder: (CompletionSearch) completionSearch
{
NSString *parentId = @"root";
GTLRDriveQuery_FilesList *query = [GTLRDriveQuery_FilesList query];
query.q = [NSString stringWithFormat:@"'%@' in parents and trashed != true and '%@' in owners and name = '%@'", parentId, self.client.authenticator.usermail, [NSBundle appName]];
query.orderBy = @"modifiedTime desc";
query.pageSize = 1000;
query.fields = kQueryFieldsFolder;
[[self driveService] executeQuery:query completionHandler:^(GTLRServiceTicket *ticket,
GTLRDrive_FileList *fileList,
NSError *error) {
if (!error)
{
NSLog(@"Drive search root folder results - %li", (unsigned long)fileList.files.count);
NSString * newRootId = [fileList.files.firstObject identifier];
if (newRootId.length > 0)
{
self.rootFolder = [fileList.files.firstObject folder];
if (completionSearch)
completionSearch(YES, nil);
}
else
{
if (completionSearch)
completionSearch(NO, nil);
}
}
else
{
if (completionSearch)
completionSearch(NO, error);
NSLog(@"DRIVE An error occurred: %@", error);
}
}];
}
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'rootURLString should end in a slash: (null)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3de6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff512a19b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3dbe8 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258e6c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 Snap2Clouds 0x000000010066d7a8 -[GTLRService URLFromQueryObject:usePartialPaths:includeServiceURLQueryParams:] + 2408
5 Snap2Clouds 0x000000010066fbf7 -[GTLRService executeQuery:completionHandler:] + 3095
6 Snap2Clouds 0x0000000100513058 -[SCGoogleDriveManager searchRootFolder:] + 680
7 Snap2Clouds 0x0000000100510b38 -[SCGoogleDriveManager checkRoot:] + 184
8 Snap2Clouds 0x0000000100510122 -[AppDelegate signIn:didSignInForUser:withError:] + 1202
9 Snap2Clouds 0x000000010153db9f __37-[GIDSignIn addCallDelegateCallback:]_block_invoke + 105
10 Snap2Clouds 0x0000000101538f59 -[GIDCallbackQueue fire] + 117
11 Snap2Clouds 0x000000010153da53 __38-[GIDSignIn addDecodeIdTokenCallback:]_block_invoke_2 + 609
12 Snap2Clouds 0x0000000100614b53 __71-[GTMSessionFetcher invokeFetchCallbacksOnCallbackQueueWithData:error:]_block_invoke + 51
13 Snap2Clouds 0x0000000100614843 __66-[GTMSessionFetcher invokeOnCallbackQueue:afterUserStopped:block:]_block_invoke + 515
14 libdispatch.dylib 0x0000000104342f11 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x0000000104343e8e _dispatch_client_callout + 8
16 libdispatch.dylib 0x0000000104351e67 _dispatch_main_queue_callback_4CF + 1357
17 CoreFoundation 0x00007fff23da1869 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
18 CoreFoundation 0x00007fff23d9c3b9 __CFRunLoopRun + 2041
19 CoreFoundation 0x00007fff23d9b8a4 CFRunLoopRunSpecific + 404
20 GraphicsServices 0x00007fff38c05bbe GSEventRunModal + 139
21 UIKitCore 0x00007fff49372964 UIApplicationMain + 1605
22 Snap2Clouds 0x000000010052e1b0 main + 112
23 libdyld.dylib 0x00007fff5211c1fd start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
- (GTLRService *)driveService
{
static GTLRService *service = nil;
if (!service)
{
service = [[GTLRService alloc] init];
service.shouldFetchNextPages = NO;
service.retryEnabled = YES;
}
if (!service.authorizer)
{
service.authorizer = self.client.authenticator.googleAuthorizer;
}
return service;
}
------------------------------------ (GTLRService *)driveService
{
static GTLRService *service = nil;
if (!service)
{
service = [[GTLRService alloc] init];
service.shouldFetchNextPages = NO;
service.retryEnabled = YES;
service.rootURLString = @"https://www.googleapis.com/";
service.servicePath = @"drive/v3/";
service.resumableUploadPath = @"resumable/upload/";
service.simpleUploadPath = @"upload/";
service.batchPath = @"batch/drive/v3";
service.prettyPrintQueryParameterNames = @[ @"prettyPrint" ];
}
if (!service.authorizer)
{
service.authorizer = self.client.authenticator.googleAuthorizer;
}
return service;
}
-----------------------------------