ios应用程序中未触发ionic2推送通知推送打开(';通知';)
我是ios新手,我使用ionic2和angular2创建了一个应用程序,需要集成推送通知,完成所有证书工作,与FCM集成, 但无法接收通知 下面是我的代码ios应用程序中未触发ionic2推送通知推送打开(';通知';),ios,angular,push-notification,ionic2,Ios,Angular,Push Notification,Ionic2,我是ios新手,我使用ionic2和angular2创建了一个应用程序,需要集成推送通知,完成所有证书工作,与FCM集成, 但无法接收通知 下面是我的代码 initPushNotification() { if (!this.platform.is('cordova')) { alert('Push notifications not initialized. Cordova is not available - Run in physical device'); return;
initPushNotification() {
if (!this.platform.is('cordova')) {
alert('Push notifications not initialized. Cordova is not
available - Run in physical device');
return;
}
const options: PushOptions = {
android: {
senderID: 'testid'
},
ios: {
alert: 'true',
badge: false,
sound: 'true'
},
windows: {}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('registration').subscribe((data: any) => {
console.log('device token -> ' + data.registrationId);
});
pushObject.on('notification').subscribe((data: any) => {
alert('message -> ' + data.message);
//if user using app and push notification comes
if (data.additionalData.foreground) {
alert(data.message);
} else {
//if user NOT using app and push notification comes
//TODO: Your logic on click of push notification directly
//this.nav.push(DetailsPage, { message: data.message });
alert('Push notification clicked');
this.nav.setRoot(HomePage);
}
});
pushObject.on('error').subscribe(error => alert('Error with Push plugin' + error));
在上面的代码中,我可以使用pushObject.on('registration')获取令牌,但是没有触发pushObject.on('notification')
在xcode中,我激活了推入功能。所以没有问题,
FCM中的某些内容我认为我丢失了,有人能帮忙吗您是否在控制台上的firebase配置的
云消息
选项卡上配置了p12文件?是的,我已将apn证书上载到firebase控制台。但是没有运气