Today, i’ll talk about the problem, where your Production Apple Push Notification Service Certificate is not recognized by Push Sharp.
I use Push Sharp [Github] to send push notifications to the iOS devices.
Somehow things were Ok, until I was using my development / sandbox certificate. But then when the Production APNS certificates were being used to send Push Notifications, I received an exception in PushSharp which read:
You have selected the Production server, yet your Certificate does not appear to be the Production certificate! Please check to ensure you have the correct certificate!
After thoroughly revisiting other tech blogs, I found that Apple has changed the name in the Production Service from : “Apple Production IOS Push Services” to “Apple Push Services”
So, to fix this:
- Go to ApplePushChannelSettings.cs file
- Go to CheckProductionCertificateMatching(bool production) method
- Change the If condition from
- if (production && !subjectName.Contains(“Apple Production IOS Push Services”)) to if (production && !subjectName.Contains(“Apple Push Services”))
- Secondly, in the bool DetectProduction(X509Certificate2 certificate) function change the If Condition from if (subjectName.Contains(“Apple Production IOS Push Services”)) to if (subjectName.Contains(“Apple Push Services”))
That is it! Build your project and your distribution / production push notification service is ready to use!