shakebugs / shake-react-native

Bug reporting SDK for React Native apps.
https://shakebugs.com
12 stars 1 forks source link

Push notifications crash: Firebase + Shake #3

Open davidteejay opened 10 months ago

davidteejay commented 10 months ago

We are currently experiencing some issues with our app, after integrating Shake. We noticed that whenever a user receives a push notification (both foreground and quit state), the application crashes. Here is a stack trace for the crash:

Crashed: com.apple.main-thread
0  CoreFoundation                 0x84260 CFAllocatorAllocate + 4
1  CoreFoundation                 0x87168 __CFStringChangeSizeMultiple + 628
2  CoreFoundation                 0x8157c __CFStringAppendBytes + 840
3  CoreFoundation                 0x5100c __CFStringAppendFormatCore + 9656
4  CoreFoundation                 0x841d4 _CFStringCreateWithFormatAndArgumentsReturningMetadata + 184
5  CoreFoundation                 0x80aac _CFStringCreateWithFormatAndArgumentsAux2 + 44
6  Foundation                     0x1aeb8 +[NSString stringWithFormat:] + 68
7  --------------                  0x10d770 +[FIRMessagingLogger formatMessageCode:] + 32 (FIRMessagingLogger.m:32)
8  --------------                  0x10d7bc -[FIRMessagingLogger logFuncDebug:messageCode:msg:] + 41 (FIRMessagingLogger.m:41)
9  --------------                  0x10b680 +[FIRMessagingContextManagerService isContextManagerMessage:] + 72 (FIRMessagingContextManagerService.m:72)
10 --------------                  0x1026ac -[FIRMessaging appDidReceiveMessage:] + 368 (FIRMessaging.m:368)
11 --------------                  0x1108d4 FCMSwizzleWillPresentNotificationWithHandler + 479 (FIRMessagingRemoteNotificationsProxy.m:479)
12 --------------                  0x18d580 -[RNFBMessagingUNUserNotificationCenter userNotificationCenter:willPresentNotification:withCompletionHandler:] + 100 (RNFBMessaging+UNUserNotificationCenter.m:100)
13 Shake                          0xc93bc -[SHKNotificationProxy userNotificationCenter:willPresentNotification:withCompletionHandler:] + 308
14 --------------                  0x1108f0 FCMSwizzleWillPresentNotificationWithHandler + 482 (FIRMessagingRemoteNotificationsProxy.m:482)
15 UIKitCore                      0x3fa9f8 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 175400
16 UIKitCore                      0x209d2c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 308
17 UIKitCore                      0x209ad0 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 4363831536
18 UIKitCore                      0x209910 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 175400
19 FrontBoardServices             0x3ac8 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 308
20 FrontBoardServices             0x3904 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 4363831536
21 FrontBoardServices             0x7120 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 175400
22 FrontBoardServices             0x703c __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 308
23 libdispatch.dylib              0x3eac _dispatch_client_callout + 4363831536
24 libdispatch.dylib              0x791c _dispatch_block_invoke_direct + 175400
25 FrontBoardServices             0x1124c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 308
26 FrontBoardServices             0x10de8 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 4363831536
27 FrontBoardServices             0x13694 -[FBSSerialQueue _performNextFromRunLoopSource] + 175400
28 CoreFoundation                 0xd3128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 308
29 CoreFoundation                 0xdf7b4 __CFRunLoopDoSource0 + 4363831536
30 CoreFoundation                 0x645e8 __CFRunLoopDoSources0 + 175400
31 CoreFoundation                 0x7a0d4 __CFRunLoopRun + 308
32 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific + 4363831536
33 GraphicsServices               0x135c GSEventRunModal + 175400
34 UIKitCore                      0x39cf58 -[UIApplication _run] + 308
35 UIKitCore                      0x39cbbc UIApplicationMain + 4363831536
36 --------------                  0x620c main + 8 (main.m:8)
37 ???                            0x1c5f38dec -[SHKNotificationProxy userNotificationCenter:willPresentNotification:withCompletionHandler:] + 308

Is there something we're missing in the setup? I'd really appreciate it if we could resolve this soon, as it has a really high impact on our product.

Thank you!

abbasmoosavi commented 9 months ago

Hi @mstanic-shake, Could you please solve it soon? I have used this library in my app and i have it problem too. Thanks

abbasmoosavi commented 9 months ago

We are currently experiencing some issues with our app, after integrating Shake. We noticed that whenever a user receives a push notification (both foreground and quit state), the application crashes. Here is a stack trace for the crash:

Crashed: com.apple.main-thread
0  CoreFoundation                 0x84260 CFAllocatorAllocate + 4
1  CoreFoundation                 0x87168 __CFStringChangeSizeMultiple + 628
2  CoreFoundation                 0x8157c __CFStringAppendBytes + 840
3  CoreFoundation                 0x5100c __CFStringAppendFormatCore + 9656
4  CoreFoundation                 0x841d4 _CFStringCreateWithFormatAndArgumentsReturningMetadata + 184
5  CoreFoundation                 0x80aac _CFStringCreateWithFormatAndArgumentsAux2 + 44
6  Foundation                     0x1aeb8 +[NSString stringWithFormat:] + 68
7  --------------                  0x10d770 +[FIRMessagingLogger formatMessageCode:] + 32 (FIRMessagingLogger.m:32)
8  --------------                  0x10d7bc -[FIRMessagingLogger logFuncDebug:messageCode:msg:] + 41 (FIRMessagingLogger.m:41)
9  --------------                  0x10b680 +[FIRMessagingContextManagerService isContextManagerMessage:] + 72 (FIRMessagingContextManagerService.m:72)
10 --------------                  0x1026ac -[FIRMessaging appDidReceiveMessage:] + 368 (FIRMessaging.m:368)
11 --------------                  0x1108d4 FCMSwizzleWillPresentNotificationWithHandler + 479 (FIRMessagingRemoteNotificationsProxy.m:479)
12 --------------                  0x18d580 -[RNFBMessagingUNUserNotificationCenter userNotificationCenter:willPresentNotification:withCompletionHandler:] + 100 (RNFBMessaging+UNUserNotificationCenter.m:100)
13 Shake                          0xc93bc -[SHKNotificationProxy userNotificationCenter:willPresentNotification:withCompletionHandler:] + 308
14 --------------                  0x1108f0 FCMSwizzleWillPresentNotificationWithHandler + 482 (FIRMessagingRemoteNotificationsProxy.m:482)
15 UIKitCore                      0x3fa9f8 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 175400
16 UIKitCore                      0x209d2c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 308
17 UIKitCore                      0x209ad0 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 4363831536
18 UIKitCore                      0x209910 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 175400
19 FrontBoardServices             0x3ac8 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 308
20 FrontBoardServices             0x3904 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 4363831536
21 FrontBoardServices             0x7120 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 175400
22 FrontBoardServices             0x703c __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 308
23 libdispatch.dylib              0x3eac _dispatch_client_callout + 4363831536
24 libdispatch.dylib              0x791c _dispatch_block_invoke_direct + 175400
25 FrontBoardServices             0x1124c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 308
26 FrontBoardServices             0x10de8 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 4363831536
27 FrontBoardServices             0x13694 -[FBSSerialQueue _performNextFromRunLoopSource] + 175400
28 CoreFoundation                 0xd3128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 308
29 CoreFoundation                 0xdf7b4 __CFRunLoopDoSource0 + 4363831536
30 CoreFoundation                 0x645e8 __CFRunLoopDoSources0 + 175400
31 CoreFoundation                 0x7a0d4 __CFRunLoopRun + 308
32 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific + 4363831536
33 GraphicsServices               0x135c GSEventRunModal + 175400
34 UIKitCore                      0x39cf58 -[UIApplication _run] + 308
35 UIKitCore                      0x39cbbc UIApplicationMain + 4363831536
36 --------------                  0x620c main + 8 (main.m:8)
37 ???                            0x1c5f38dec -[SHKNotificationProxy userNotificationCenter:willPresentNotification:withCompletionHandler:] + 308

Is there something we're missing in the setup? I'd really appreciate it if we could resolve this soon, as it has a really high impact on our product.

Thank you!

@davidteejay Hi, Have you ever found solution for this problem?

abbasmoosavi commented 9 months ago

Owner of this module has went to sleep :-)

davidteejay commented 8 months ago

Not exactly. I included a timeout to delay Shake.start():

registerAppWithFCM();
setupFirebaseNotifications();
setTimeout(() => {
  startShake();
}, 3000);

This seemed to solve the problem for a while, but it's recently started to happen again

vibinjoby commented 8 months ago

I'm on the latest version of react-native-shake and I still experience a crash on iOS "@shakebugs/react-native-shake": "16.2.1", Mine is a fairly new react-native app with 0.73.x version so it should be pretty straight forward to reproduce

mstanic-shake commented 7 months ago

Hi @vibinjoby, we are mostly using our slack channel or feedback board for bug reporting.

It's most probably an issue because of Firebase/Shake initialization order. You can check our example and see how it is set up there: https://github.com/shakebugs/shake-react-native/blob/master/example/ios/example/AppDelegate.m

Also please add a full code snippet where you are initializing Firebase/Shake so we can check it.

@monika-marovic