Closed Aurelienlajoinie closed 4 years ago
You received a crash, what is the crash trace?
Oh sorry, forgot to share it ...
Crash stack from crashlytics:
From device log:
{"app_name":"app-iphone","timestamp":"2020-09-01 16:00:30.12 +0200","app_version":"3.17.1 - recette","slice_uuid":"20379eea-a080-3f9d-a3fc-bf423314d241","adam_id":0,"build_version":"502","bundleID":"fr.max.ios.recette","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 13.3.1 (17D50)","incident_id":"4D37CFB0-5B6E-4D24-BD30-75B498C27C4D","name":"app-iphone"}
Incident Identifier: 4D37CFB0-5B6E-4D24-BD30-75B498C27C4D
CrashReporter Key: dc14779b7d5fc5ff46a91d3b5dbd377a8b343930
Hardware Model: iPhone10,6
Process: app-iphone [1063]
Path: /private/var/containers/Bundle/Application/DFA0C30F-8F2C-4CD0-94C6-F13033AB22C3/app-iphone.app/app-iphone
Identifier: fr.test.app
Version: 502 (3.17.1 - recette)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: fr.test.app [1095]
Date/Time: 2020-09-01 16:00:29.7055 +0200
Launch Time: 2020-09-01 15:59:30.6270 +0200
OS Version: iPhone OS 13.3.1 (17D50)
Release Type: User
Baseband Version: 3.03.03
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGILL)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016ed4bfd0
VM Region Info: 0x16ed4bfd0 is in 0x16ed48000-0x16ed4c000; bytes after start: 16336 bytes before end: 47
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
mapped file 0000000133510000-00000001335d8000 [ 800K] r--/r-- SM=SHM ...t_id=f82bfa09
GAP OF 0x3b770000 BYTES
---> STACK GUARD 000000016ed48000-000000016ed4c000 [ 16K] ---/rwx SM=NUL ... for thread 0
Stack 000000016ed4c000-000000016ee48000 [ 1008K] rw-/rwx SM=COW thread 0
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: app-iphone [1063]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.usernotifications.UNUserNotificationServiceConnection
Thread 0 Crashed:
0 libsystem_malloc.dylib 0x00000001b4f5f118 0x1b4f5c000 + 12568
1 libsystem_malloc.dylib 0x00000001b4f5e5a4 0x1b4f5c000 + 9636
2 libsystem_malloc.dylib 0x00000001b4f5ea8c 0x1b4f5c000 + 10892
3 libsystem_malloc.dylib 0x00000001b4f6b928 0x1b4f5c000 + 63784
4 libsystem_malloc.dylib 0x00000001b4f6c20c 0x1b4f5c000 + 66060
5 libobjc.A.dylib 0x00000001b4faf978 0x1b4f98000 + 96632
6 libdispatch.dylib 0x00000001b4f42a20 0x1b4ee7000 + 375328
Mmmm :thinking: that's probably not this module. Could be this module but my hunch is it probably is either code you are adding (what is that rich notification extension? What happens when you take it out? or it is upstream (try overriding to the 6.31.1 and doing npx react-native-clean-project
to make sure it takes effect https://firebase.google.com/support/release-notes/ios (these overrides can be a point of bisection as well, perhaps going backwards in versions https://rnfirebase.io/#ios)
There is also
[FIRMessaging messaging].delegate = self;
[self initializeRemoteNotifications];
And tons of remote notifications code in AppDelegate. If you can reproduce with a clean example from https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh and an App.js we can try to pinpoint it
We are using several tools managing notifications, rich notification extension is a notification extension for one of them. This tools is used for remote and in app push campaign and the extension is necessary to manage notification with pictures/songs/video. We ara also using react-native-notification from wix in order to manage foreground and action on notifcations. And at the end a chat which is able receive notifications too... All AppDelegate code is here to satisfied those tools requirement.
I wiil try to override and upgrade SDK and let you know if it resolve our problem. Thanks for your help ;)
My hunch is the error is in all of the code you describe as necessary for various features - I'm not saying it is not necessary for your features, I'm just saying that if you temporarily rip it out (or, disable half of it if possible, to "bisect" the error by half iteratively) the problem is probably in there. Messaging is one of the most used features in this library and it is unlikely (possible! but unlikely) that there is a latent crash bug in the messaging code, especially when you have so much project-specific code in the area.
Hello, updating to Native SDK v6.31.1 doesn't solve our problem. Now i will try to remove some AppDelegate specific code to find the real problem.
EDIT: I found the problem, but not the solution... when i remove our in-app/remote push campaign tool it works ! So the problem is between messaging and this one but this tool's code isn't open source. So i will wait for an update and if this new version fix the problem i will remove the patch-package on messaging.
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
Hello everyone,
We are facing an issue after updating all firebase package. When we try to open notification while app is killed, the app startup and immediately crash mentionned an error in the RNFBMessagingUNUserNotificationCenter file from messaging. After some debug the problem is in the method didReceiveNotificationResponse:
i quick fix the problem just by comment delegate callback and so always use "default" completionHandler:
I don't understand what appends because _originalDelegate and originalDelegateRespondsTo seems to be ok but the crash is here :s
Project Files
package.json
:firebase.json
for react-native-firebase v6:iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: #### `AppDelegate.m`: ```objc - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"app" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; rnBridgeFromRootView = rootView.bridge; //set the bridge to be exposed and returned later and used by the swift class self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; // bootsplash [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // Firebase configuration // We get the Firebase config file name from the GoogleService-Info.plist // @see Replace GoogleService-Info.plist task [FIRApp configure]; [FIRMessaging messaging].delegate = self; [self initializeRemoteNotifications]; //.... return YES; } - (void) initializeRemoteNotifications { NSLog(@"[AppDelegate] Notifications - initializeRemoteNotification"); UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) { if(!error) { [[UIApplication sharedApplication] registerForRemoteNotifications]; [RNNotifications startMonitorNotifications]; NSLog( @"[AppDelegate] Notifications - Push registration success." ); } else { NSLog( @"[AppDelegate] Notifications - Push registration FAILED" ); NSLog( @"[AppDelegate] Notifications - ERROR: %@ - %@", error.localizedFailureReason, error.localizedDescription ); NSLog( @"[AppDelegate] Notifications - SUGGESTIONS: %@ - %@", error.localizedRecoveryOptions, error.localizedRecoverySuggestion ); } } ]; } // This function is added here only for debugging purposes, and can be removed if swizzling is enabled. // If swizzling is disabled then this function must be implemented so that the APNs device token can be paired to // the FCM registration token. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSLog(@"[AppDelegate] Notifications - Register device token %@", deviceToken); // With swizzling disabled you must set the APNs device token here. [FIRMessaging messaging].APNSToken = deviceToken; // register to firebase for react-native-notifications library [RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { // The token is not currently available. NSLog(@"[AppDelegate] Notifications - Remote notification support is unavailable due to error: %@", err); // register to firebase for react-native-notifications library failed [RNNotifications didFailToRegisterForRemoteNotificationsWithError:err]; } //Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { NSLog(@"[AppDelegate] Notifications - willPresentNotification"); completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo { NSLog(@"[AppDelegate] Notifications - didReceiveRemoteNotification"); [[FIRMessaging messaging] appDidReceiveMessage:userInfo]; [self application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:^(UIBackgroundFetchResult result) { NSLog(@"[AppDelegate] Notifications - didReceiveRemoteNotification (fetchCompletionHandler - UIBackgroundFetchResult)"); }]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{ NSLog(@"[AppDelegate] Notifications - didReceiveRemoteNotification (fetchCompletionHandler)"); completionHandler(UIBackgroundFetchResultNewData); } ```