I used PushSharp 2.0.4 and its fires an exception while sending notification to apple:
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!
I notice that due to change in apple certificate policies and i think there are a hard coded value in the pushsharp 2 that referee to the old certificate name.
I don't want to transfer to the new pushsharp 3 version till now but i want to fix this issue in my pushsharp 2.0 code.
I think the change should be in ApplePushChannelSettings class:
private void CheckProductionCertificateMatching(bool production)
{
if (this.Certificate == null)
{
throw new ArgumentNullException("You must provide a Certificate to connect to APNS with!");
}
string name = this.Certificate.IssuerName.Name;
string name2 = this.Certificate.SubjectName.Name;
if (!name.Contains("Apple"))
{
throw new ArgumentException("Your Certificate does not appear to be issued by Apple! Please check to ensure you have the correct certificate!");
}
if (production && !name2.Contains("Apple Production IOS Push Services") && !name2.Contains("Apple Push Services"))
{
throw new ArgumentException("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!");
}
if (!production && !name2.Contains("Apple Development IOS Push Services") && !name2.Contains("Pass Type ID"))
{
throw new ArgumentException("You have selected the Development/Sandbox (Not production) server, yet your Certificate does not appear to be the Development/Sandbox certificate! Please check to ensure you have the correct certificate!");
}
}
In this line:
if (production && !name2.Contains("Apple Production IOS Push Services") && !name2.Contains("Apple Push Services"))
{
throw new ArgumentException("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!");
}
But I have a question for any one faced this issue before, is this the only change should done and also what is the correct change to be done or to be specific what is the correct value that apple used instead of this?
Update: I commenting some lines in ApplePushChannelSettings.cs, the lines that fire exception, and the notifications sent correctly to android only and the issue still in ios.