简体   繁体   English

在ios上没有收到离子3推送通知

[英]ionic 3 push notification not received on ios

I am trying to do an android push notification by following this doc i understood that i need 我正在尝试按照这个文件做一个android推送通知,我明白我需要

  1. device token 设备令牌
  2. api key api key
  3. sender id 发件人ID

i am getting device token and i have created a project in FCM and i got sender id and api key . 我正在获取设备令牌,我已经在FCM中创建了一个项目,我得到了发件人ID和api密钥。

but i am not able to receive the push notification form the backend her is my code that i have used in app.component.ts file 但是我无法从后端收到推送通知她是我在app.component.ts文件中使用的代码

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');
        }
      });

      // to initialize push notifications

      const options: PushOptions = {
        android: {
            senderID: '129188921379'
        },
        ios: {
            alert: 'true',
            badge: true,
            sound: 'false'
        },
        windows: {}
      };

      const pushObject: PushObject = push.init(options);

      pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));

      pushObject.on('registration').subscribe((registration: any) => {
        console.log('Device registered', registration);
        self.deviceToken = registration.registrationId;
      });

      pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));

i am not getting any error how do i check where is the mistake from front end or back end 我没有得到任何错误我如何检查从前端或后端的错误在哪里

i am not getting any registredId for iphone what is the issue but for android i am getting 我没有得到任何registredId的iPhone是什么问题,但对于Android我得到

你在push.init之前调用.hasPermission

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM