FCM.presentLocalNotification not working on iOS
See original GitHub issuern 39.2 rn-fcm: 2.5.2 iOS 10.1
The below method is not working on iOS 10.1, it does not show a local notification when the app is in foreground:
RCT_EXPORT_METHOD(presentLocalNotification:(id)data resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{
if([UNUserNotificationCenter currentNotificationCenter] != nil){
UNNotificationRequest* request = [RCTConvert UNNotificationRequest:data];
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
if (!error) {
resolve(nil);
}else{
reject(@"notification_error", @"Failed to present local notificaton", error);
}
}];
}else{
UILocalNotification* notif = [RCTConvert UILocalNotification:data];
[RCTSharedApplication() presentLocalNotificationNow:notif];
resolve(nil);
}
}
However if I go back to the older code that it is only:
UILocalNotification* notif = [RCTConvert UILocalNotification:data];
[RCTSharedApplication() presentLocalNotificationNow:notif];
resolve(nil);
it works fine
how can I add logs on native code to debug properly this? or add a breaking point?
cc @MechanicKim had the same issue
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:64 (29 by maintainers)
Top Results From Across the Web
Remote push notification not firing off using react native fcm
I have all of my capabilities check on in Xcode, I'm running this on an iOS 8 Device, and I'm using react-native-fcm 16.0.0...
Read more >App does not launch by data FCM | Apple Developer Forums
I'm facing similar issue under these conditions: Running on iOS 15.2 (19C5044b); App is running in foreground and is actively receiving touch inputs;...
Read more >evollu/react-native-fcm - Gitter
this version of presentLocalNotification stops the App really bad. ... I've got FCM installed and notifications are showing up in my emulator (though...
Read more >react-native-fcm-fix: Documentation - Openbase
In firebase console, you can: for Android: download google-services.json file and place it in android/app directory; for iOS: download GoogleService-Info ...
Read more >PushNotificationIOS.presentLocalNotification() doesn't work in ...
presentLocalNotification () doesn't work in react-native. ... after dismissing a modally presented ViewController · Uiswitch does not change the state ios ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
sure you can do the work around. I will play with it myself and figure out the fix.
there must be a way, let me check