PushSharp 4.0.10, MVC 4 with C#
Apns 브로커의 OnNotificationFailed 이벤트에서 ConnectionError 예외가 발생합니다.
이 예외는 인증서 (.p12) 파일을 변경 한 후 갑자기 발생했습니다. 이 변경 전에는 정상적으로 작동했습니다.
이 오류를 해결하는 방법을 알려주십시오. 생성자를 apnsconfiguration, 또는 다른 validateIsApnsCertificate (부울) 매개 변수를 제거 만 처음 두 개의 매개 변수를 전달하여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();
나는 똑같은 문제를 겪고 있는데, 나에게 도움이되지 못했다. – Angel
해결책을 찾았습니까? – user3151766