当推送到iOS时,使用Cordova和Phonegap Push Plugin在app服务器上获得invalidRegistration

时间:2022-01-08 15:17:46

I used this instruction on Google Cloud Messaging site to set certificates for APNS. I'm on development phase and set only development certificate in Apple Developer Console. Then I set up phonegap-plugin-push and initialized it in JS like that (on deviceready of course):

我在Google Cloud Messaging网站上使用此说明为APNS设置证书。我正处于开发阶段,只在Apple Developer Console中设置了开发证书。然后我设置了phonegap-plugin-push并在JS中初始化它(当然是在设备上):

var pushController = PushNotification.init({
    "android": {
      "senderID": "_",
      "forceShow": true
    },
    "ios": {
      "alert": "true",
      "badge": "true",
      "sound": "true"
    }
  });

pushController.on('registration', function (data) {
  console.log("Push registration", data);
});

So when registration is successful I see registration id of the device in console. But when I try to push message from server to this registration id I get error response with code invalidRegistration. I'm pushing from node.js server with gcm package.

因此,当注册成功时,我会在控制台中看到设备的注册ID。但是当我尝试将消息从服​​务器推送到此注册ID时,我得到错误响应,代码为invalidRegistration。我正在从带有gcm包的node.js服务器上推送。

Same setup works great on Android. I wasn't sure about correctness of certificates and repeated process strictly following instructions. But result on iOS is the same.

相同的设置在Android上运行良好。我不确定证书的正确性和严格遵循指示的重复过程。但iOS上的结果是一样的。

1 个解决方案

#1


0  

As it heppens best way to solve the problem is to recheck every stage of process 100th time. The problem was in server side sertificate. It wasn't the same as the one that app and apns used.

因为它解决问题的最佳方法是重新检查过程的每个阶段第100次。问题出在服务器端证书上。它与app和apns使用的不一样。

Now I have problem with ad hoc production version but that's another story.

现在我对ad hoc制作版本有疑问,但这是另一个故事。

#1


0  

As it heppens best way to solve the problem is to recheck every stage of process 100th time. The problem was in server side sertificate. It wasn't the same as the one that app and apns used.

因为它解决问题的最佳方法是重新检查过程的每个阶段第100次。问题出在服务器端证书上。它与app和apns使用的不一样。

Now I have problem with ad hoc production version but that's another story.

现在我对ad hoc制作版本有疑问,但这是另一个故事。