Ionic原生推送注册格式变了?

Ionic native push registration format changed?

不知道为什么,推送注册的界面好像变了?

我的应用遵循

中的逻辑

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

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

其中 registration 曾经属于以下类型

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

但现在我得到

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

registrationID以前是字符串,现在是字典。我现在应该如何处理这个ID?我必须以某种方式将它转换为推送令牌......发生了什么变化?我查看了 phone gap 插件代码,但找不到它... https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m

终于找到线索了。 iOS 13 的发布似乎改变了这一点。

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

Cordova 推送插件必须更新到 v2.3.0(我还没有测试过),但我当前的版本失败,因为 v2.2.3 正在通过错误的方法访问 registrationId

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

我在 ionic 1 应用程序中遇到了同样的问题。必须将推送插件的版本从 2.2.3 升级到 2.3.0。此外,我还将 cordova-support-google-services 升级到 1.3.2 以使其工作。虽然跟android有关,但还是不得不做。此插件 (phonegap-plugin-multidex) 的版本应大于或等于 1.0.0 推送通知对我来说工作正常的插件如下:

phonegap-plugin-multidex 1.0.0 "Multidex"

phonegap-plugin-push 2.3.0 "PushPlugin"

cordova-support-google-服务 1.3.2 "cordova-support-google-services"

希望这有帮助