google / GTMAppAuth

Apple platforms SDK for using AppAuth with Google libraries.
Apache License 2.0
374 stars 196 forks source link

Crash: OIDURLQueryComponent.m line 117 #88

Open andy61i opened 5 years ago

andy61i commented 5 years ago

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:

andy61i commented 5 years ago

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) {...}];