Open sitangruan opened 7 years ago
Copy pasted from the readme file, this prints the exception to the console.
// Wire up events
apnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
aggregateEx.Handle (ex => {
// See what kind of exception it was to further diagnose
if (ex is ApnsNotificationException) {
var notificationException = (ApnsNotificationException)ex;
// Deal with the failed notification
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
Console.WriteLine ($"Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}");
} else {
// Inner exception might hold more useful information like an ApnsConnectionException
Console.WriteLine ($"Apple Notification Failed for some unknown reason : {ex.InnerException}");
}
// Mark it as handled
return true;
});
};
Copy pasted from Exception.cs
public enum ApnsNotificationErrorStatusCode
{
NoErrors = 0,
ProcessingError = 1,
MissingDeviceToken = 2,
MissingTopic = 3,
MissingPayload = 4,
InvalidTokenSize = 5,
InvalidTopicSize = 6,
InvalidPayloadSize = 7,
InvalidToken = 8,
Shutdown = 10,
ConnectionError = 254,
Unknown = 255
}
What version of PushSharp are you using?
I was using 2.2.1, now I am upgrading to 4.0
Describe your issue:
My previous codes in 2.2.1 are like this PushBroker push = new PushBroker();
In that way I could handle a lot of events/exceptions, specially like DeviceSubscriptionExpired DeviceSubscriptionChanged.
However after upgrade to 4.0, the new broker object has only Succeed/Failed events provided so the codes are like this, var broker = new ApnsServiceBroker(config); broker.OnNotificationFailed += (notification, exception) => { failed++; }; broker.OnNotificationSucceeded += (notification) => { succeeded++; };
So how can I see those few other events/exceptions which were available in older version? Is there any work around?
What are the steps required to reproduce this issue?
None
Please provide any Exception Stack Traces
None