Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APN Production certificate not being recognized by PushSharp

I've developed an iOS app, that receives Push Notifications. I'm sending them from a .NET environment using PushSharp. Everything went beautifully while developing, and the Pushs were successfully sent:

var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Development.p12");
push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
    .ForDeviceToken(token)
    .WithContentAvailable(1)
);
push.StopAllServices();

Now, the app has been approved, and it's at AppStore. I have generate the correct production certificate:

var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Production.p12");
push.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
    .ForDeviceToken(token)
    .WithContentAvailable(1)
);
push.StopAllServices();

but when I try to send the push from PushSharp, it throws the following exception:

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'm pretty sure I've followed all the steps. I've downloaded the production certificate that was binded with the provisioning file set in the app to publish. Opened it and exported the .p12.

I'm also sure I'm not using a development one by accident, because, if I set PushSharp for development, using this last certificate, it throws the following error:

You have selected the Development/Sandbox (Not production) server, yet your Certificate does not appear to be the Development/Sandbox (Not production) certificate! Please check to ensure you have the correct certificate!

How can the certificate be neither Development, nor Production?

Is there somewhere I can validate the file? Please give me some insigth on this matter, as I have no clue where to start

like image 491
LcSalazar Avatar asked Feb 13 '15 12:02

LcSalazar


Video Answer


1 Answers

When you create production certificate (.p12) for .NET, Always export like selecting the certificate only. see the attached image

http://davidbits.blogspot.in/2016/02/error-you-have-selected-production.html

enter image description here

like image 133
jpulikkottil Avatar answered Oct 04 '22 22:10

jpulikkottil