[英]firebase-x@ionic 4 not showing push messages (FCM)
I created this code in my app console:我在我的应用程序控制台中创建了此代码:
app.compontent.ts app.component.ts
this.firebaseX.getToken().then(token => console.log('PUSH_TOKEN: GET_TOKEN: ', token))
.catch(err => console.log(err));
if (this.platform.is('ios')) {
this.firebaseX.grantPermission().then(hasPermission => console.log(hasPermission ? 'granted' : 'denied'));
this.firebaseX.onApnsTokenReceived().subscribe(token => console.log('PUSH_TOKEN: IOS_TOKEN: ' + token));
}
this.firebaseX.onMessageReceived().subscribe(message => console.log(message));
Chrome console after sending push message via firebase console:通过 firebase 控制台发送推送消息后的 Chrome 控制台:
xCode Console when app init:应用程序初始化时的 xCode 控制台:
2020-01-19 17:09:22.816015+0100 myApp[8896:2663293] registerForRemoteNotifications
2020-01-19 17:09:22.816107+0100 myApp[8896:2663293] _hasPermission: YES
...
2020-01-19 17:09:22.821477+0100 myApp[8896:2663036] PUSH_TOKEN: IOS_TOKEN: d2aac51a963530-FULL_TOKEN_HERE
2020-01-19 17:09:22.821807+0100 myApp[8896:2663036] PUSH_TOKEN: GET_TOKEN: frWxHosY-gQ:APA91bEk3-FULL_TOKEN_HERE
...
2020-01-19 17:13:46.395935+0100 myApp[8896:2663036] FCM direct channel = true
2020-01-19 17:15:39.418759+0100 myApp[8896:2663036] FCM direct channel = false
I'm running my app in debug env.我在调试环境中运行我的应用程序。
Current behavior:当前行为:
Android:安卓:
iOS: IOS:
iOS: 13.3 (17C54) iOS:13.3 (17C54)
xCode: 11.3 (11C29) xCode:11.3 (11C29)
"cordova-plugin-firebasex": "^7.0.1" “cordova-plugin-firebasex”:“^7.0.1”
What should i do to start receiving pushes on iOS?我应该怎么做才能开始在 iOS 上接收推送?
I solved my problem.我解决了我的问题。
I forgot to upload my .p8 key to firebase.我忘了将我的 .p8 密钥上传到 firebase。 https://firebase.google.com/docs/cloud-messaging/ios/certs
https://firebase.google.com/docs/cloud-messaging/ios/certs
Lesson learnt: always read documentation :)经验教训:始终阅读文档:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.