Azure Notification Hub registrations disappear when sending a notification

断了今生、忘了曾经 提交于 2019-11-29 13:04:47

问题


Recently our Azure Notification Hub became a very mysterious entity. When Apple devices register we can see them in Service Bus Explorer and as soon as we try sending any notifications (from SBE or Azure Portal) we get a "Notification Successful" message, but nothing appears on the device. Refreshing registration list uncovers the fact that the registrations were deleted.

We are not removing them anywhere in code, and the TTL has not expired.

Any suggestions?


回答1:


Notification hub cleans up registrations with invalid tokens during the send flow. Looks like for some reasons APNS rejects your tokens and NH just removes registrations. Make sure:

  1. you are getting token from physical device (not emulator);
  2. APNS certificate uploaded to NH is not expired;
  3. APNS certificate uploaded to NH corresponds APNS endpoint you are using in application (sandbox or production).



回答2:


Turns out the front end guys were unsubscribing too eagerly. Removing the unsubscribe code sorted out the issue. Also there was a problem with the APNS certificate, in order to run the front end app in debug it requires a sandbox certificate, not a production one, for the messages to be delivered properly.




回答3:


We had this exact error, but it turned out we were accidently using a "distribution" provisioning profile with a "development"/ sandbox push notification certificate. After switching to a development provisioning profile, push notifications worked!



来源:https://stackoverflow.com/questions/28190777/azure-notification-hub-registrations-disappear-when-sending-a-notification

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