PushSharp returns invalid token for newly created P12

帅比萌擦擦* 提交于 2019-12-25 06:23:21

问题


I have had an email from Apple saying that my push notifications certificate is due to expire, so trying to be proactive I have regenerated the certificate and exported the P12 however now when I use that new P12 instead of the old one PushSharp gives me an "Invalid Token" error. If then I use the old P12, the notification is sent successfully.

I have now tried to revoke the old certificate as my theory was that the old certificate was still being used by the application to generate the device's token, however the old P12 still works, the new one doesn't.

Do I have to wait for the old certificate to fully expire before the new one will work?

What other reason could there be for Push Sharp to raise an "Invalid Token" exception?

All this is against a TestFlight (Adhoc) version with the Production ApnsServerEnvironment set for PushSharp.


回答1:


After further investigation, I have found that the P12 export needs to occur against the certificate and not the private key.

I seem to have been mislead by the instructions here https://developer.xamarin.com/guides/ios/application_fundamentals/notifications/remote_notifications_in_ios/

Export the Certificate - Expand the certificate so the associated private key is visible, right-click on the key and chose Export. You will be prompted for a filename and a password for the exported file.



来源:https://stackoverflow.com/questions/42810721/pushsharp-returns-invalid-token-for-newly-created-p12

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