Open Dec- opened 5 years ago
This is also happening for my team. Been stuck for over a week.
Let us check that.
Well, I just tried it on one of our production iOS releases and it is working.
Strange, once I put my app in the background, xcode says: Disconnected from FCM.
I Googled "disconnected from FCM" and got https://github.com/arnesson/cordova-plugin-firebase/issues/888
Yes, been looking at that thread but none of the solutions seems to fix the problem.
Make sure your xCode project Capabilities include "Background mode" -> "Remote Notifications" Or add this to your config.xml
<platform name="ios">
......
<config-file parent="UIBackgroundModes" platform="ios" target="*-Info.plist">
<array>
<string>remote-notification</string>
</array>
</config-file>
<preference name="SplashScreen" value="screen" />
</platform>
I fixed by add the following code:
AppDelegate+FirebasePlugin.m
swizzledDidFinishLaunchingWithOptions
add registerUserNotificationSettings
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:)
name:kFIRInstanceIDTokenRefreshNotification object:nil];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge |
UIUserNotificationTypeAlert |
UIUserNotificationTypeSound
categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
self.applicationInBackground = @(YES);
and add this function
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
[application registerForRemoteNotifications];
}
and setup Background mode -> Remote Notifications in info.plist
it will work
Does IOS background operation not receive notification have not been repaired yet? I did not solve my problem with the above scheme.
I often encounter the error of Invalid Apns Credential, but the certificate is not expired. I hope you can help me.
There is also this which can mess up iOS notifications. The problem is not identical to what I have experienced but close enough so that this might be contributing.
// window.FirebasePlugin.hasPermission((data) => {
// if (!data.isEnabled) {
window.FirebasePlugin.grantPermission();
// }
// });
I.e. make sure you do not call hasPermission because you need to call grantPermission regardless of the return value.
Describe the bug
Push notification working fine on Android but on iOS notification are not displaying when app is in background or closed. When app i opend and i push notification from Firebase console notification is visible but when i exit from app and do the same thing, notification is not visible.
Steps to reproduce the behavior:
Plugin Version
cordova-plugin-firebase-lib 3.0.0 "Google Firebase Plugin"
Smartphone (please complete the following information):
Additional context
When i open the application after sending notification from Firebase console and app was in the background, suddenly notification is visible...
Can some1 help?