在iOS上使用Ionic和Firebase推送通知
我使用这些说明在iOS上使用Firebase设置推送通知。我非常确定我已经正确设置了所有苹果证书,我可以从FCM(Firebase Cloud Messaging)发送通知,状态为“已发送”,但它们从未到达我的iPhone 这是我的密码。任何建议,为什么这是不工作或如何调试它将高度赞赏!!非常感谢在iOS上使用Ionic和Firebase推送通知,ios,firebase,push-notification,ionic2,firebase-cloud-messaging,Ios,Firebase,Push Notification,Ionic2,Firebase Cloud Messaging,我使用这些说明在iOS上使用Firebase设置推送通知。我非常确定我已经正确设置了所有苹果证书,我可以从FCM(Firebase Cloud Messaging)发送通知,状态为“已发送”,但它们从未到达我的iPhone 这是我的密码。任何建议,为什么这是不工作或如何调试它将高度赞赏!!非常感谢 import { Push, PushObject, PushOptions } from '@ionic-native/push'; constructor(platform: Platform
import { Push, PushObject, PushOptions } from '@ionic-native/push';
constructor(platform: Platform, private push: Push, public alertCtrl: AlertController) {
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
this.pushNotifications();
});
}
pushNotifications() {
this.push.hasPermission().then((res: any) => {
if (res.isEnabled) { console.log('We have permission to send push notifications');}
else { console.log('We do NOT have permission to send push notifications'); }
}).catch((error) => { console.log("Push Notification needs Cordova: " + JSON.stringify(error));});
const options: PushOptions = {
android: {
senderID: 'My_ID'
},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => {
if(notification.additionalData.foreground) {
let youralert = this.alertCtrl.create({
title: 'New Push notification',
message: notification.message
});
youralert.present();
}
});
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', JSON.stringify(registration)));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}
您是否尝试过通过在线apns测试工具发送推送通知?
(像。)。如果仍然存在相同的问题,请再次检查您的ios证书、配置和设备检查。您应该添加FCM插件,并在链接中找到: 然后在插件中找到以下文件:
“AppDelegate+FCM”
您可以在此处找到以下方法:
customDidFinishLaunchingWithOptions
请替换以下内容:
[FIRApp configure];
with this
// [START configure_firebase]
if(![FIRApp defaultApp]){
[FIRApp configure];
}
您是否尝试过将有效负载
优先级设置为高
?@AL。我该怎么做?谢谢它实际上是在Firebase中默认设置的。所以,不幸的是,这没有帮助。我对本机推送插件也有类似的问题。然后我迁移到ionic原生fcm插件()。这个fcm插件正在工作。