繁体   English   中英

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

[英]ionic 3 push notification not received on ios

我正在尝试按照这个文件做一个android推送通知,我明白我需要

  1. 设备令牌
  2. api key
  3. 发件人ID

我正在获取设备令牌,我已经在FCM中创建了一个项目,我得到了发件人ID和api密钥。

但是我无法从后端收到推送通知她是我在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));

我没有得到任何错误我如何检查从前端或后端的错误在哪里

我没有得到任何registredId的iPhone是什么问题,但对于Android我得到

你在push.init之前调用.hasPermission

暂无
暂无

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

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