Hello,
Thank you very much in advance!!
Since yesterday suddenly we are facing an issue to send a notification to iOS devices.
We are using PushSharp.apple v4.0.10 and certification authentication (.p12)
I was debugging the implementation and found that ApnsServiceBroker is not responding after calling a stop() method, Not triggering any of the OnNotificationFailed or OnNotificationSucceeded event, Also not receiving any exception from ApnsServiceBroker instance.
Please find code snippet below,
string certName = AppDomain.CurrentDomain.BaseDirectory + ServiceHelper.GetAppSettingsStringValue("APNSDevCert", string.Empty);
byte[] _applePushNotificationCertificate = File.ReadAllBytes(certName);
ApnsConfiguration config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, _applePushNotificationCertificate, "CertPassword");
ApnsServiceBroker apnsBroker = new ApnsServiceBroker(config);
FeedbackService fbs = new FeedbackService(config);
apnsBroker.Start();
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = "DeviceToken",
apnsBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
aggregateEx.Handle(ex =>
{
// See what kind of exception it was to further diagnose
if (ex is ApnsNotificationException)
{
ApnsNotificationException notificationException = (ApnsNotificationException)ex;
// Deal with the failed notification
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
log.Error($"Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}" + "Message=" + ex.Message + "stckstrace=" + ex.StackTrace);
}
else
{
// Inner exception might hold more useful information like an ApnsConnectionException
log.Error($"Apple Notification Failed for some unknown reason : {ex.InnerException}" + "Message=" + ex.Message + "stckstrace=" + ex.StackTrace);
}
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) =>
{
log.Info($"Apple Notification Sent for ID={notification.DeviceToken}");
};
fbs.FeedbackReceived += (string deviceTokenLocal, DateTime timestamp) =>
{
log.Info($"Apple Notification Sent for ID={deviceTokenLocal}");
};
I am not getting any exception, any error, any success or any feedback response after calling apnsBroker.Stop() method. Till yesterday it was perfectly working.
Did any one faced the same kind of issue.
Thank you very much in advance!!
Since yesterday suddenly we are facing an issue to send a notification to iOS devices.
We are using PushSharp.apple v4.0.10 and certification authentication (.p12)
I was debugging the implementation and found that ApnsServiceBroker is not responding after calling a stop() method, Not triggering any of the OnNotificationFailed or OnNotificationSucceeded event, Also not receiving any exception from ApnsServiceBroker instance.
Please find code snippet below,
string certName = AppDomain.CurrentDomain.BaseDirectory + ServiceHelper.GetAppSettingsStringValue("APNSDevCert", string.Empty);
byte[] _applePushNotificationCertificate = File.ReadAllBytes(certName);
ApnsConfiguration config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, _applePushNotificationCertificate, "CertPassword");
ApnsServiceBroker apnsBroker = new ApnsServiceBroker(config);
FeedbackService fbs = new FeedbackService(config);
apnsBroker.Start();
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = "DeviceToken",
Code Block Payload = JObject.Parse("{\"aps\":{\"alert\":\"Test Message\",\"badge\":0,\"content-available\":1,\"sound\":\"default\"}}") });
apnsBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
aggregateEx.Handle(ex =>
{
// See what kind of exception it was to further diagnose
if (ex is ApnsNotificationException)
{
ApnsNotificationException notificationException = (ApnsNotificationException)ex;
// Deal with the failed notification
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
log.Error($"Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}" + "Message=" + ex.Message + "stckstrace=" + ex.StackTrace);
}
else
{
// Inner exception might hold more useful information like an ApnsConnectionException
log.Error($"Apple Notification Failed for some unknown reason : {ex.InnerException}" + "Message=" + ex.Message + "stckstrace=" + ex.StackTrace);
}
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) =>
{
log.Info($"Apple Notification Sent for ID={notification.DeviceToken}");
};
fbs.FeedbackReceived += (string deviceTokenLocal, DateTime timestamp) =>
{
log.Info($"Apple Notification Sent for ID={deviceTokenLocal}");
};
Code Block apnsBroker.Stop();
I am not getting any exception, any error, any success or any feedback response after calling apnsBroker.Stop() method. Till yesterday it was perfectly working.
Did any one faced the same kind of issue.