简体   繁体   English

Cordova Firebase插件:安装新应用程序时,Apple Push通知有时不起作用

[英]Cordova Firebase plugin: Apple Push notifications do not work sometimes when installing a new app

I'm building a new version of a Cordova project that uses the push notifications for the first time. 我正在构建一个第一次使用推播通知的Cordova项目的新版本。 I use the 'cordova-plugin-firebase' version 1.0.5 for handling them. 我使用“ cordova-plugin-firebase”版本1.0.5来处理它们。 Everything works fine on Android, but on iOS I seem to have a problem. 在Android上一切正常,但在iOS上似乎有问题。 If I download the official app from AppStore and then upgrade it with the new version via XCode, the push notifications doesn't seem to work (no "message" appears at the top in iOS). 如果我从AppStore下载官方应用程序,然后通过XCode将其升级为新版本,则推送通知似乎无效(iOS顶部没有“消息”出现)。 If I have the app opened, the XCode debugger prints the push notification and it looks like this: 如果我打开了应用程序,则XCode调试器将打印推送通知,如下所示:

{
  "collapse_key" = "bundle_ID";
  from = FIREBASE_ID;
  notification = {
    body = "This is a message";
    title = "Message";
  };
  tap = 0;
}

If I then close the XCode project and create a new one (or open this newly created one again) with all source copied to it and the cordova plugins installed into and then build and install it via XCode, the push notifications start working again and the push notification in the XCode debugger looks like this: 如果然后我关闭XCode项目并创建一个新项目(或再次打开此新创建的项目),并将所有源复制到该项目中,然后将cordova插件安装到其中,然后通过XCode构建并安装它,则推送通知将再次开始工作,并且XCode调试器中的推式通知如下所示:

{
  aps = {
    alert =         {
        body = "This is a message";
        title = "Message";
    };
  };
  tap = 0;
}

Should push notification formats differ? 推送通知格式应该不同吗? Has anyone experienced some similar behavior and how did you solve it? 有没有人遇到过类似的行为,您如何解决?

It seems there was a bug or something in the iOS project. 看来iOS项目中有错误或其他内容。 When I removed the ios platform and newly installed it everything started working and it still works until this day. 当我删除ios平台并重新安装它后,一切都开始工作,直到今天仍在工作。

Also Apple's APS has different push notification object structure than Android's FCM. 此外,苹果的APS具有与Android的FCM不同的推送通知对象结构。

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

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