Closed brainssolutions closed 5 years ago
same here, notifications are working great in android, not in iOS.
What I do in android:
What I do in iOS
getting permission
this.firebase.hasPermission().then(data => {
if (!data.isEnabled) {
this.firebase.grantPermission().then(data => {
})
.catch(error => {
console.error('Error getting permissions', error);
return false;
});
}
});
getting device's token
const currentToken = await this.firebase.getToken()
this seems to work, and I am receiving a token. However, the token doesn't seem to work (both in my API or with the firebase console).
I am using cordova-plugin-firebase 2.0.5
EDIT : It looks like data is received by the app in foreground, but i can't see any notifications in background (background-capabilities for remote-notifications in xcode are activated).
2019-02-06 11:32:08.262779+0100 my-app[1150:403123] Received data message: {
"collapse_key" = "my-app";
from = 90723358823;
notification = {
body = "test";
e = 1;
tag = "campaign_collapse_key_214309173097139";
title = "test";
};
}
2019-02-06 11:32:08.271278+0100 my-app[1150:403123] {"from":"90723358823","collapse_key":"my-app","notification":{"body":"test","title":"test","e":"1","tag":"campaign_collapse_key_214309173097139"}}
I just upgraded my project.
On Firebase I changed by uploading the authentication key to the APN. I have updated for security files. plist in my project Cordova and I deleted and added again the iOS platform. By running the application in debug through Xcode you can see when it follows:
**2019-02-06 15:55:46.053973+0100 DietaConCharme[1089:226305] Starting Firebase plugin
2019-02-06 15:55:47.744272+0100 DietaConCharme[1089:226417] 5.7.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at: https://firebase.google.com/docs/cloudmessaging/ios/client#method_swizzling_in_firebase_messaging
5:47.744437+0100 DietaConCharme[1089:226417] 5.7.0 - [Firebase/Messaging][I-FCM002023] The object <AppDelegate: 0x28006f300> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.
2019-02-06 15:55:50.701606+0100 DietaConCharme[1089:226305] THREAD WARNING: ['FirebasePlugin'] took '14.846924' ms. Plugin should use a background thread.
2019-02-06 15:56:32.406138+0100 DietaConCharme[1089:226413] 5.7.0 - [Firebase/Messaging][I-FCM002023] The object <FirebasePlugin: 0x28236f8e0> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.
2019-02-06 15:56:32.783147+0100 DietaConCharme[1089:226663] 5.7.0 - [Firebase/InstanceID][I-IID003014] Error while reading embedded mobileprovision Error Domain=NSCocoaErrorDomain Code=260 "The file “embedded.mobileprovision” couldn’t be opened becau**
Does anyone have any solutions on that?
UPDATE The problem seems to be here. In fact if I try to send a notification to that token the response from Firebase is that it is not registered.
[Firebase/Messaging][I-FCM002023] The object <AppDelegate: 0x2821bb5e0> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.
same here ...
I'm getting this same error. I can see the notification once I launch the app but the notification does not show in the system tray.
so i can finally get it works with this : https://github.com/arnesson/cordova-plugin-firebase/issues/970#issuecomment-453819328
so i can finally get it works with this : #970 (comment)
Hi, thanks for your help.
I tried as specified in the post and it actually works!
Thank you very much!
Hi Guys, I tried adding comment #970 but I'm still having the message on my XCode console. Though I could receive the Notification if I set the app on background but when its on foreground I don't receive the message. Also, I can't see the message on XCode Logs
@bryyyanribo did you ever end up fixing your issue? I've tried all other solutions with the exception of changing the system to legacy, and none of those worked for me. I can't switch to legacy because when I do, it can't properly emulate the app.
@evinkuraga, I tried upgrading my cordova ios to 5.0.0. I think you don't have to to set the workspace settings to legacy since, I used the new build settings. Also, try upgrading your local notifications and cordova firebase. That's works for me.
Here's my package json:
"dependencies": { "@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/fire": "^5.1.1", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@ionic-native/core": "^5.0.0", "@ionic-native/firebase": "^5.0.0", "@ionic-native/in-app-browser": "^5.0.0", "@ionic-native/local-notifications": "^5.0.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^4.1.1", "angular-instantsearch": "^2.1.0", "cordova-android": "7.1.4", "cordova-android-play-services-gradle-release": "2.0.0", "cordova-browser": "5.0.4", "cordova-ios": "5.0.0", "cordova-plugin-badge": "^0.8.8", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-firebase": "^2.0.5", "cordova-plugin-inappbrowser": "^3.0.0", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^2.4.0", "cordova-plugin-local-notification": "^0.9.0-beta.3", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "^1.3.3", "core-js": "^2.5.4", "firebase": "^5.8.2", "ionicons": "^4.5.5", "moment": "^2.22.2", "rxjs": "^6.3.3", "text-mask-core": "^5.1.2", "zone.js": "^0.8.29" }
Also, try to add comment #970. It might also help. :)
What's the usage of cordova-pluginlocal-notification for this?
I'm stuck on FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented #996
Firebase Console is not an issue tho, I receive notifications successfully through it
Hi @JoseGeorges8, I used it for displaying out the notification I receive on background mode, also to know that it displays on foreground mode :)
I just set it to legacy build system and the plugin works fine "cordova-ios": "4.5.5", "cordova-plugin-firebase": "^2.0.5", "firebase": "^5.8.6",
@evinkuraga, I tried upgrading my cordova ios to 5.0.0. I think you don't have to to set the workspace settings to legacy since, I used the new build settings. Also, try upgrading your local notifications and cordova firebase. That's works for me.
Here's my package json:
"dependencies": { "@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/fire": "^5.1.1", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@ionic-native/core": "^5.0.0", "@ionic-native/firebase": "^5.0.0", "@ionic-native/in-app-browser": "^5.0.0", "@ionic-native/local-notifications": "^5.0.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^4.1.1", "angular-instantsearch": "^2.1.0", "cordova-android": "7.1.4", "cordova-android-play-services-gradle-release": "2.0.0", "cordova-browser": "5.0.4", "cordova-ios": "5.0.0", "cordova-plugin-badge": "^0.8.8", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-firebase": "^2.0.5", "cordova-plugin-inappbrowser": "^3.0.0", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^2.4.0", "cordova-plugin-local-notification": "^0.9.0-beta.3", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "^1.3.3", "core-js": "^2.5.4", "firebase": "^5.8.2", "ionicons": "^4.5.5", "moment": "^2.22.2", "rxjs": "^6.3.3", "text-mask-core": "^5.1.2", "zone.js": "^0.8.29" }
Also, try to add comment #970. It might also help. :)
Hi @bryyyanribo, I face the same issue, I've tried others solutions but still cannot work. I use same as your packages except that: cordova : 9.0.0, "@angular/": "~9.1.6", "cordova-ios": "6.1.0"
Do you think this is a matter?
Describe the bug The real or emulated device not receive any push notification.