繁体   English   中英

Ionic Push FCM iOS - 获取设备令牌(不是 firebase 令牌)

[英]Ionic Push FCM iOS - get device token (not firebase token)

当我在 iOS 上使用FCM(Firebase Cloud Messaging) cordova plugin时,我得到这个令牌:

c-NtgjPB8Rg:APA91bEk0bvwec5tGjzCYQ_0I2axwpFmuRJ1JRUpHwdcTkVV1J1AR_Xb3p7qYp68il0y_TmiJ4ecQYDQdCFDLwzA-KALA_I7Q2tUOW2zszsDA0lPD8tvo0IlRYhf1Z5KwhR5u6h02z2w

但它应该是这种格式:

3b985a82 451ef20d f6f6e481 8de19a3d 1855e6de daf09915 e9b8a42b 3c05c79c

我正在使用这种方法:

this.fcm.getToken().then(token => { /*saving token here*/});

我是否收到某种Firebase令牌? 如何获得APNS令牌?

你得到的令牌看起来是正确的,它与我得到的完美工作的令牌非常相似。 它不应该有任何空格。

您可以使用 getAPNSToken() 函数:

 this.fcm.getAPNSToken().then(token => { /*saving token here*/});

您也将验证平台:

   if (this.platform.is('android')){
      token= await this.fcm.getToken();
    }

    if (this.platform.is('ios')) {
      token= this.fcm.getAPNSToken()
    }

暂无
暂无

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

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