google / GTMAppAuth

Apple platforms SDK for using AppAuth with Google libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash: OIDURLQueryComponent.m line 117

andy61i opened this issue · comments

Happens for some users on iOS 12 and 13.

Here is a log from Fabric:

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x1f043298c __exceptionPreprocess
1 libobjc.A.dylib 0x1ef60b9f8 objc_exception_throw
2 CoreFoundation 0x1f03ac3f8 _CFArgv
3 CoreFoundation 0x1f031d0cc -[__NSArrayM insertObject:atIndex:]
4 Safe In Cloud.Free 0x100c86314 -[OIDURLQueryComponent addParameter:value:] + 117 (OIDURLQueryComponent.m:117)
5 Safe In Cloud.Free 0x100c8495c -[OIDTokenRequest URLRequest] + 297 (OIDTokenRequest.m:297)
6 Safe In Cloud.Free 0x100c77b80 +[OIDAuthorizationService performTokenRequest:originalAuthorizationResponse:callback:] + 433 (OIDAuthorizationService.m:433)
7 Safe In Cloud.Free 0x100c7b004 -[OIDAuthState performActionWithFreshTokens:additionalRefreshParameters:dispatchQueue:] + 513 (OIDAuthState.m:513)
8 Safe In Cloud.Free 0x100c7ad6c -[OIDAuthState performActionWithFreshTokens:additionalRefreshParameters:] + 465 (OIDAuthState.m:465)
9 Safe In Cloud.Free 0x100c87fb8 -[GTMAppAuthFetcherAuthorization authorizeRequestArgs:] + 235 (GTMAppAuthFetcherAuthorization.m:235)
10 Safe In Cloud.Free 0x100c888f4 -[GTMAppAuthFetcherAuthorization authorizeRequest:delegate:didFinishSelector:] + 370 (GTMAppAuthFetcherAuthorization.m:370)
11 Safe In Cloud.Free 0x100c931d8 -[GTMSessionFetcher authorizeRequest] + 1600 (GTMSessionFetcher.m:1600)
12 Safe In Cloud.Free 0x100c8fadc -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] + 751 (GTMSessionFetcher.m:751)
13 Safe In Cloud.Free 0x100cb7518 -[GTLRService fetchObjectWithURL:objectClass:bodyObject:dataToPost:ETag:httpMethod:mayAuthorize:completionHandler:executingQuery:ticket:] + 867 (GTLRService.m:867)
14 Safe In Cloud.Free 0x100cb8c34 -[GTLRService fetchObjectWithURL:objectClass:bodyObject:ETag:httpMethod:mayAuthorize:completionHandler:executingQuery:ticket:] + 1127 (GTLRService.m:1127)
15 Safe In Cloud.Free 0x100cbcda4 -[GTLRService executeQuery:completionHandler:] + 2248 (GTLRService.m:2248)
16 Safe In Cloud.Free 0x100c2851c __24-[GDriveDriver userInfo]_block_invoke + 132 (GDriveDriver.m:132)

The calling code:

NSError* error = nil;
GTLRDriveQuery_AboutGet *query = [GTLRDriveQuery_AboutGet query];
query.fields = @"kind,user(kind,displayName,emailAddress,photoLink)";
[self.service executeQuery:query completionHandler:^(GTLRServiceTicket *ticket, id about, NSError *error) {...}];

Pod file:

pod 'GoogleAPIClientForREST'
pod 'GoogleAPIClientForREST/Drive'
pod 'GoogleAPIClientForREST/Oauth2'
pod 'GTMAppAuth'
pod 'AppAuth'

Pod.lock:

  • AppAuth (1.2.0):
    • AppAuth/Core (= 1.2.0)
    • AppAuth/ExternalUserAgent (= 1.2.0)
  • AppAuth/Core (1.2.0)
  • AppAuth/ExternalUserAgent (1.2.0)
  • GoogleAnalytics (3.17.0)
  • GoogleAPIClientForREST (1.3.10):
    • GoogleAPIClientForREST/Core (= 1.3.10)
    • GTMSessionFetcher (>= 1.1.7)
  • GoogleAPIClientForREST/Core (1.3.10):
    • GTMSessionFetcher (>= 1.1.7)
  • GoogleAPIClientForREST/Drive (1.3.10):
    • GoogleAPIClientForREST/Core
    • GTMSessionFetcher (>= 1.1.7)
  • GoogleAPIClientForREST/Oauth2 (1.3.10):
    • GoogleAPIClientForREST/Core
    • GTMSessionFetcher (>= 1.1.7)
  • GTMAppAuth (1.0.0):
    • AppAuth/Core (~> 1.0)
    • GTMSessionFetcher (~> 1.1)
  • GTMSessionFetcher (1.2.2):
    • GTMSessionFetcher/Full (= 1.2.2)
  • GTMSessionFetcher/Core (1.2.2)
  • GTMSessionFetcher/Full (1.2.2):
    • GTMSessionFetcher/Core (= 1.2.2)

The problem can be reproduced if self.service.authorizer is not properly initialized.

@Property (nonatomic) GTLRDriveService* service;
...
NSError* error = nil;
GTLRDriveQuery_AboutGet *query = [GTLRDriveQuery_AboutGet query];
query.fields = @"kind,user(kind,displayName,emailAddress,photoLink)";
[self.service executeQuery:query completionHandler:^(GTLRServiceTicket *ticket, id about, NSError *error) {...}];