-->

Devices being unregistered after push is sent

2019-02-26 12:16发布

问题:

This might sound weird, but I can't see any other explanation.

I've setup IBM Push Notifications on Bluemix, which I have done before. For some reason on this new app that i've built. Any time I send a push notification, it doesn't come through, I try to do so again and it tells me there are no devices.

This only happened to me today, maybe its an issue with the service?

Some things i've tried / noticed:

  • My device is being registered and receiving successful messages from the service via the console.
  • I only have 1 device, but monitoring is now telling me 7 devices have registered for notifications.
  • When using the web console for sending push notifications, it says successful the first time (but nothing comes through), clicking again, says Internal Server error: No devices found.
  • Using swagger docs, I input my appID and search for devices, none show up. I run the app, one shows up, I place the app in background, one still shows up. I send a notification through swagger, says successful, check for registered devices, returns empty array.
  • Code in my iOS app is limited to the sample provided for the IMFPush / IMFCore cocoapods, for registering. I have no unsubscribe code of any kind.
  • I have verified this without running any of my node.js code, or iOS code using only the swagger / web console tools.
  • I'm using a sandbox provision profile I have used previously for a different app.
  • I have deleted the IMF push service and recreated.

Any help / insights would be greatly appreciated.

回答1:

@Simon please re-download the push sandbox certificate and export it from the keychain as .p12. This seems to have solve the problem. It seems strange though that a bad private key was giving you the "Invalid Token". so apple server is deleting the devices when you tried to send notification to invalid token devices. Please make sure you are following the right steps to generate the Sandbox or Production certificate https://console.ng.bluemix.net/docs/services/mobilepush/t_push_provider_ios.html



回答2:

@SimonMcLoughlin found the root cause for this issue, it is because of bad private key. To resolve this issue just generate a .p12 certificate with .pem . For creating the p12 file with .pem file please follow the below method