Sto utilizzando PushSharp 4.0.10, MVC 4 con C#
Nell'evento OnNotificationFailed del broker Apns, ottengo l'eccezione ConnectionError.
Questa eccezione si è verificata improvvisamente dopo il file di certificato di modifica (.p12); e ha funzionato bene prima di questo cambiamento.
Si prega di indicare come risolvere questo errore.Errore di notifica PushSharp Apns: 'ConnectionError'
var certificate = System.IO.File.ReadAllBytes(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/Mobile/consumer_dev.p12"));
var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, certificate, "", true);
var apnsBroker = new ApnsServiceBroker(config);
apnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
aggregateEx.Handle (ex => {
if (ex is ApnsNotificationException) {
var notificationException = (ApnsNotificationException)ex;
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
Debug.WriteLine(apnsNotification.Identifier + ", " + statusCode);
} else {
Debug.WriteLine(ex.InnerException);
}
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) => {
Debug.WriteLine("Apple Notification Sent!");
};
apnsBroker.Start();
foreach (var deviceToken in to)
{
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = deviceToken,
Payload = JObject.Parse("{\"aps\":" + aps.ToString().Replace('=', ':') + "}")
});
}
apnsBroker.Stop();
Sto avendo lo stesso problema e questo non ha funzionato per me. – Angel
Hai trovato la soluzione? – user3151766