Description
Description
We have been experiencing intermittent errors in retrieving the token via Firebase Crashlytics since June 24th. Upon analysis, it appears that the fcmToken is occasionally nil in the didReceiveRegistrationToken
method. While I have searched for similar issues, none seem to match our case.
We are currently storing the fcmToken in a singleton variable (I understand this is not ideal, but we plan to address it after an upcoming security review). The fcmToken is set exclusively in the didReceiveRegistrationToken
method, and is only retrieved elsewhere in the code.
Example:
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {
NSLog(@"FCM registration token: %@", fcmToken);
[HDSingleton sharedInstance].fcmToken = fcmToken;
//doSometing
}
I initially considered that the issue might be due to calling the variable before the singleton instance is created, but this seems unlikely as the error has been consistently occurring 1-8 times daily since June 24th. (Interestingly, this error did not occur before June 24th and has only started affecting some users since then.)
I checked the Firebase SDK version change log and noticed an update on June 24th. Although the update details do not specifically mention changes related to fcmToken, I suspect there might be a compatibility issue if there were server-side changes.
Attached are the relevant Firebase Crashlytics logs and information. Please let me know if additional data is required.
Note:
The code on line 96 of HDLoginPresenter.m is as follows:
NSDictionary *userInfo = @{@"fcmToken": [HDSingleton sharedInstance].fcmToken};
This error occurs because we are attempting to insert a nil value into the NSDictionary.
Reproducing the issue
I tried debugging by manually setting the singleton variable to nil, which resulted in the same error in the code. However, I could not replicate this issue during actual use. All the information we have comes from the errors reported in Firebase Crashlytics. (We are conducting tests in our development environment on actual devices, but have not been able to reproduce the error.)
- (Although problems occur on other days as well, 13,607 people used the app on July 9 alone. Among them, the issue occurred for 7 users. Therefore, it is even more difficult to reproduce.)
Firebase SDK Version
10.25.0
Xcode Version
15.3
Installation Method
CocoaPods
Firebase Product(s)
Messaging
Targeted Platforms
iOS
Relevant Log Output
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x83f20 __exceptionPreprocess
1 libobjc.A.dylib 0x16018 objc_exception_throw
2 CoreFoundation 0x15e6c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
3 CoreFoundation 0x15a88 +[NSDictionary dictionaryWithObjects:forKeys:count:]
4 MyApp 0x44bf0 __47-[HDLoginPresenter requestAPIcheckInWithBlock:]_block_invoke + 96 (HDLoginPresenter.m:96)
5 MyApp 0x775d4 __81-[HDNetworkManager HTTPRequestOperationWithRequest:useIndicator:success:failure:]_block_invoke + 206 (HDNetworkManager.m:206)
6 libdispatch.dylib 0x213c _dispatch_call_block_and_release
7 libdispatch.dylib 0x3dd4 _dispatch_client_callout
8 libdispatch.dylib 0x125ec _dispatch_main_queue_drain
9 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF
10 CoreFoundation 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
11 CoreFoundation 0x53914 __CFRunLoopRun
12 CoreFoundation 0x52cd8 CFRunLoopRunSpecific
13 GraphicsServices 0x11a8 GSEventRunModal
14 UIKitCore 0x40a90c -[UIApplication _run]
15 UIKitCore 0x4be9d0 UIApplicationMain
16 MyApp 0xbb490 main + 14 (main.m:14)
17 ??? 0x1ba425e4c (누락)
Crashed: com.google.firebase.crashlytics.ios.exception
0 FirebaseCrashlytics 0x21c10 FIRCLSProcessRecordAllThreads + 184
1 FirebaseCrashlytics 0x21ff0 FIRCLSProcessRecordAllThreads + 1176
2 FirebaseCrashlytics 0x18e74 FIRCLSHandler + 48
3 FirebaseCrashlytics 0x13a84 __FIRCLSExceptionRecord_block_invoke + 96
4 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20
5 libdispatch.dylib 0x132c4 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 FirebaseCrashlytics 0x12a00 FIRCLSExceptionRecord + 220
7 FirebaseCrashlytics 0x13548 FIRCLSExceptionRecordNSException + 456
8 FirebaseCrashlytics 0x12608 FIRCLSTerminateHandler() + 404
9 libc++abi.dylib 0x14068 std::__terminate(void (*)()) + 16
10 libc++abi.dylib 0x1400c std::terminate() + 108
11 libobjc.A.dylib 0x3cafc objc_terminate + 16
12 libdispatch.dylib 0x3de8 _dispatch_client_callout + 40
13 libdispatch.dylib 0x125ec _dispatch_main_queue_drain + 1060
14 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
16 CoreFoundation 0x53914 __CFRunLoopRun + 1996
17 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
18 GraphicsServices 0x11a8 GSEventRunModal + 164
19 UIKitCore 0x40a90c -[UIApplication _run] + 888
20 UIKitCore 0x4be9d0 UIApplicationMain + 340
21 MyApp 0xbb490 main + 14 (main.m:14)
22 ??? 0x1ba425e4c (누락)
com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x4f20 mach_msg_overwrite + 436
3 libsystem_kernel.dylib 0x4d60 mach_msg + 24
4 CoreFoundation 0x53f5c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x53600 __CFRunLoopRun + 1208
6 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
7 Foundation 0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 Foundation 0xc7c9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9 UIKitCore 0x41e640 -[UIEventFetcher threadMain] + 420
10 Foundation 0xde718 __NSThread__start__ + 732
11 libsystem_pthread.dylib 0x606c _pthread_start + 136
12 libsystem_pthread.dylib 0x10d8 thread_start + 8
Thread
0 libsystem_kernel.dylib 0x1590 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x4980 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0x10cc start_wqthread + 8
com.google.firebase.crashlytics.MachExceptionServer
0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x4f20 mach_msg_overwrite + 436
3 libsystem_kernel.dylib 0x4d60 mach_msg + 24
4 FirebaseCrashlytics 0x1b5bc FIRCLSMachExceptionServer + 104
5 libsystem_pthread.dylib 0x606c _pthread_start + 136
6 libsystem_pthread.dylib 0x10d8 thread_start + 8
AFNetworking
0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x4f20 mach_msg_overwrite + 436
3 libsystem_kernel.dylib 0x4d60 mach_msg + 24
4 CoreFoundation 0x53f5c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x53600 __CFRunLoopRun + 1208
6 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
7 Foundation 0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 Foundation 0xc7d20 -[NSRunLoop(NSRunLoop) run] + 64
9 MyApp 0x8f87c +[AFURLConnectionOperation networkRequestThreadEntryPoint:] + 164 (AFURLConnectionOperation.m:164)
10 Foundation 0xde718 __NSThread__start__ + 732
11 libsystem_pthread.dylib 0x606c _pthread_start + 136
12 libsystem_pthread.dylib 0x10d8 thread_start + 8
Thread
0 libsystem_kernel.dylib 0x1590 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x4980 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0x10cc start_wqthread + 8
com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x4f20 mach_msg_overwrite + 436
3 libsystem_kernel.dylib 0x4d60 mach_msg + 24
4 CoreFoundation 0x53f5c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x53600 __CFRunLoopRun + 1208
6 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
7 CFNetwork 0xfdc90 _CFHostIsDomainTopLevel + 108176
8 Foundation 0xde718 __NSThread__start__ + 732
9 libsystem_pthread.dylib 0x606c _pthread_start + 136
10 libsystem_pthread.dylib 0x10d8 thread_start + 8
Thread
0 libsystem_kernel.dylib 0x1590 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x4980 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0x10cc start_wqthread + 8
Thread
0 libsystem_kernel.dylib 0x1590 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x4980 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0x10cc start_wqthread + 8
Thread
0 libsystem_kernel.dylib 0x1590 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x4980 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0x10cc start_wqthread + 8
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved
snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock
snippet
PODS:
- FirebaseAnalytics (10.25.0):
- FirebaseAnalytics/AdIdSupport (= 10.25.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseCore (10.25.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreExtension (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.25.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.25.0):
- FirebaseCore (~> 10.5)
- FirebaseInstallations (~> 10.0)
- FirebaseRemoteConfigInterop (~> 10.23)
- FirebaseSessions (~> 10.5)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseInstallations (10.25.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.3)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseRemoteConfigInterop (10.25.0)
- FirebaseSessions (10.25.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.13)
- GoogleUtilities/UserDefaults (~> 7.13)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesSwift (~> 2.1)
- FLAnimatedImage (1.0.17)
- FLEX (5.22.10)
- GoogleAppMeasurement (10.25.0):
- GoogleAppMeasurement/AdIdSupport (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.25.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.25.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.25.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleMaps (7.4.0):
- GoogleMaps/Maps (= 7.4.0)
- GoogleMaps/Base (7.4.0)
- GoogleMaps/Maps (7.4.0):
- GoogleMaps/Base
- GoogleUtilities/AppDelegateSwizzler (7.13.3):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (7.13.3):
- GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.13.3):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/MethodSwizzler (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/Network (7.13.3):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.13.3)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (7.13.3)
- GoogleUtilities/Reachability (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- nanopb (2.30910.0):
- nanopb/decode (= 2.30910.0)
- nanopb/encode (= 2.30910.0)
- nanopb/decode (2.30910.0)
- nanopb/encode (2.30910.0)
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
DEPENDENCIES:
- FirebaseAnalytics
- FirebaseCore
- FirebaseCrashlytics
- FirebaseMessaging
- FLAnimatedImage (~> 1.0)
- FLEX
- GoogleMaps
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations
- FirebaseMessaging
- FirebaseRemoteConfigInterop
- FirebaseSessions
- FLAnimatedImage
- FLEX
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleMaps
- GoogleUtilities
- nanopb
- PromisesObjC
- PromisesSwift
SPEC CHECKSUMS:
FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreExtension: 8a47811d0b155501559ef05d089518152a0a1677
FirebaseCoreInternal: 910a81992c33715fec9263ca7381d59ab3a750b7
FirebaseCrashlytics: 4b96efb0ce73b38b2a85e8b8bd1bd8f63f09d015
FirebaseInstallations: 91950fe859846fff0fbd296180909dd273103b09
FirebaseMessaging: 88950ba9485052891ebe26f6c43a52bb62248952
FirebaseRemoteConfigInterop: b25018791b204c0d78a90e394d6c62d9b1f22da8
FirebaseSessions: c0939656253a1fa0e94ecc266ccf770cc8b33732
FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b
FLEX: f21ee4f498eed3f8a1eded66b21939fd3b7a22ce
GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
nanopb: 438bc412db1928dac798aa6fd75726007be04262
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
PODFILE CHECKSUM: 42c53e4a392cb267d7a102308db901173ee5a9df
COCOAPODS: 1.15.2