Apple Push Notification Production certificate not recognized by PushSharp

Hello There,

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:

  1. Go to ApplePushChannelSettings.cs file
  2. Go to CheckProductionCertificateMatching(bool production) method
  3. Change the If condition from
    1. if (production && !subjectName.Contains(“Apple Production IOS Push Services”)) to if (production && !subjectName.Contains(“Apple Push Services”))
  4. 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!

-Cheers!

Rohant K.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s