Send Push Notification to iOS PushSharp certificate

被刻印的时光 ゝ 提交于 2020-01-07 07:37:30

问题


I'm using PushSharp 4.0.10 in my push notification server.

I can send push notifications to Android, but when I'm trying to send push notifications to ios, an error occurs:

Something went wrong in Comunications Worker: 
Method name -> PushNotifications.DispatchPushNotifications()
Message -> There is an error sending iOS push notifications.
Exception - > Specified argument was out of the range of valid values.
Parameter name: You are using a certificate created for connecting only to the Sandbox APNS server but have selected a different server environment to connect to.

I already created a certificate "Apple Push Notification service SSL (Sandbox & Production)" and also the individuals certificates "iOS App Development" and "App Store and Ad Hoc". In both cases I get the same error.

Is there any correct way to generate the certificate?

Can you point me the correct way, or is there any other bug or missing update?

Thank you, for your time.


回答1:


That error message is generated when creating an ApnsConfiguration object (see source code: https://github.com/Redth/PushSharp/blob/master/PushSharp.Apple/ApnsConfiguration.cs).

If you check how this particular exception is raised, you'll note it's based on the name of the certificate. You can remove the check by passing in false for the validateIsApnsCertificate argument when creating an ApnsConfiguration object.

This might not resolve your issue entirely (if there's something else wrong with the certificate) but if it's just the certificate's name that is the issue then this might help.



来源:https://stackoverflow.com/questions/44842024/send-push-notification-to-ios-pushsharp-certificate

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