Ionic native push registration format changed?

和自甴很熟 提交于 2020-01-25 07:00:05

问题


I am not sure why but it seems that the interface for push registration changed?

My app follows the logic from

https://ionicframework.com/docs/v3/native/push/

with

pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));

where registration used to be of below type

export interface PushDevice{
    registrationId: string;
    registrationType: string;
}

but now I am getting

{"registrationId":"{length=32,bytes=0x459ca46ab66f4fe790220809215176d6...21b3436d13e78c64}","registrationType":"APNS"}

registrationID used to be a string, but now is a dictionary. How shall I handle this ID now? I have to convert it to a push token somehow... What changed? I looked into the phone gap plugin code but I can not find it... https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m


回答1:


Finally found a lead. Seems this changed with the release of iOS 13.

https://forums.developer.apple.com/thread/117545

The Cordova push plugin has to be updated to v2.3.0 (I have not tested this yet), but my current version is failing because v2.2.3 is accessing the registrationId through a wrong method.

https://github.com/phonegap/phonegap-plugin-push/issues/2832 https://github.com/proreact/phonegap-plugin-push/commit/486c8f206536995c80101487b0fed1502edd5754



来源:https://stackoverflow.com/questions/59385617/ionic-native-push-registration-format-changed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!