Skip to content

Crash in App Check token fetch with force refresh #8544

Closed
@mikehardy

Description

@mikehardy

Step 0: Are you in the right place?

  • For issues or feature requests related to the code in this repository
    file a Github issue.
    • If this is a feature request please use the Feature Request template.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general (non-iOS) Firebase discussion, use the firebase-talk
    google group.
  • For backend issues, console issues, and other non-SDK help that does not fall under one
    of the above categories, reach out to
    Firebase Support.
  • Once you've read this section and determined that your issue is appropriate for
    this repository, please delete this section.

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.5.1
  • Firebase SDK version: 8.5.0 (but I scanned commits through 8.6.0, doesn't look addressed)
  • Installation method: CocoaPods (select one)
  • Firebase Component: App Check

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Send YES for "forceRefresh" argument in this method

(DLog is just a wrapper for standard logging, use what you need)

Relevant Code:

- getToken : (FIRApp *)firebaseApp : (BOOL)forceRefresh) { FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp]; [appCheck tokenForcingRefresh:NOcompletion:^(FIRAppCheckToken *_Nullable token, NSError *_Nullable error) { if (error != nil) { // Handle any errors if the token was not retrieved.DLog(@"Unable to retrieve App Check token: %@", error); return; } if (token == nil) { DLog(@"Unable to retrieve App Check token."); return; } DLog(@"fetched token successfully"); }]; }
App crashed: Exception was thrown: NSInvalidArgumentException *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] ( 0 CoreFoundation 0x00007fff20422faa __exceptionPreprocess + 226 1 libobjc.A.dylib 0x00007fff20193ff5 objc_exception_throw + 48 2 CoreFoundation 0x00007fff204a1523 _CFThrowFormattedException + 194 3 CoreFoundation 0x00007fff204ac91d -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0 4 CoreFoundation 0x00007fff2048f4c6 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 251 5 CoreFoundation 0x00007fff20421c42 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49 6 testing 0x000000010ff2525a -[FPersistentConnection sendAppCheckToken:] + 154 7 testing 0x000000010ff251a1 -[FPersistentConnection refreshApp<…> 

No crash if you send NO in there

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close